Nick Texidor | 29 Jun 10:13

Updating postgres 7.4.5 to 8 via cygwin

Hi,

I was wondering whether someone can help me.   I already have postgres 7.4.5 running under cygwin on my web server, and I've looked into installing the native version of 8, but it looks like there is a bit of dumping/importing of database to be done.   I noticed that postgres 8 is available under cygwin, and it came up as an update.  If I install it through cygwin, is there any messing around with databases to be done?  Is that an easier option than installing the native version and moving from a cygwin version?

Thank you

Nick


BELEM Mahamadou | 23 Jun 18:46
Picon
Favicon

why it is impossible to connect to the data base?

Dear all

I tried to connect my data base using a C++ program.

I use the following instructions  but it is impossible to make the connection.
Can someone explain me the problem.

 PGconn *conn;
 conn = PQsetdbLogin("localhost",
                     NULL,
                     NULL,
                     NULL,
                     "database",
                     "user",
                     "password");

Best regards


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
BELEM Mahamadou | 23 Jun 15:23
Picon
Favicon

Cygwin and postgresql connexion

Dear all

I am a new user of Postgresql.

I try to connect to  a data base using à C++ program. Then, I import libpq-fe.h.

By when I compile my program no error occurs but it is impossible to run the program.
The program stop wothout error during the execution. I use cygwin.

Someone can explain me the problem?

Now I want to use liqpq++ but I don't know how to import this library using cygwin.

I notice that I am using cygwin


Best regard
 


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
BELEM Mahamadou | 23 Jun 15:15
Picon
Favicon

problem of cygwin and progresql coupling


 Dear all

I am a new user of Postgresql with C++..

I try to connect to  a data base using à C++ program. Then, I import libpq-fe.h.

By when I compile my program no error occurs but it is impossible to run the program.
The program stop wothout error during the execution. I use cygwin.

Someone can explain me the problem?

Now I want to use liqpq++ but I don't know to import this library using cygwin.

I notice that I am using cygwin


Best regard


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.
Ridho Ahmad | 15 May 08:36
Picon
Favicon

Save query in csv

hi, firt my name is Rio.
i need some help for source code in c. now i use cygwin and postgre to make a program based on c.
could you help me in code, how to save query result in file. i want to make file *.csv(comma separeted value).
i have found a source code based on c to parse the file from *.csv. but i have not found source code to make file *.csv (its means that the result of query in postgre).
for helping, thhank so muc


Rio junior
Indonesia

mohan namadhari | 1 Feb 02:36
Picon
Favicon

Compiler Error - postgress make on mingw for win32

Hi,
While compiling the postgres 8.1x on mingw tool,
getting following error. Does anyone have any clue 
what is going on here? Does it requires to fix
makefile? If so which make file and what exactly is
the change required? 
Following is the error I am getting.

dlltool --dllname postgres.exe --def postgres.def
--output-lib libpostgres.a
C:\msys\1.0\mingw\bin\dlltool.exe: CreateProcess
make[2]: *** [libpostgres.a] Error 1
make[2]: *** Deleting file `libpostgres.a'
make[2]: Leaving directory `/postgresql/src/backend'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/postgresql/src'
make: *** [all] Error 2

      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Picon

Problem with compiling C function


Hello

I ma working on a server-side function written in "C" which should get a bytea type image - simple jpg picture , resize and compress it with defined paramters and return also a bytea type. I made working test code that worked fine as a console program.
My boss demands it to be compiled in Windows (postgreSQL server is  running on Windows 2003)  , so  I created this project in Borland C++ Builder 6.0.
I am not using Cygwin.
PostgreSQL C external function has to be built into dll , so I created new project DLL Wizard - C style dll.
Later I changed some code , and pasted it to the DLL "C" style , and  wanted to build dll.
My Code:
-----------------------------------------------------------------------------
#include "postgres.h "
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <stat.h>
#include <setjmp>
#include "jerror.h"
#include "jpeglib.h"
 
#pragma argsused
extern __declspec(dllexport) bytea* kompresuj(bytea* obrazek,int zdjwyj_sz, int zdjwyj_w,int stkompr);

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
        return 1;
}

struct my_error_mgr {
struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer;
};
typedef struct my_error_mgr *my_error_ptr;
void my_error_exit(j_common_ptr cinfo)
{
my_error_ptr myerr = (my_error_ptr) cinfo->err;
(*cinfo->err->output_message) (cinfo);
longjmp(myerr->setjmp_buffer, 1);
}

int czytajwymiarywej(char *filename,int wymiary[])
{        struct jpeg_decompress_struct cinfo;
        struct my_error_mgr jerr;
        FILE *infile;

        if ((infile = open(filename, O_RDONLY|O_BINARY,S_IREAD)) == NULL) {
        return -1;
        }

        jerr.pub.error_exit = my_error_exit;
        cinfo.err = jpeg_std_error(&jerr.pub);
        jpeg_CreateDecompress(&cinfo,JPEG_LIB_VERSION,(size_t)sizeof(cinfo));
        if (setjmp(jerr.setjmp_buffer)) {
        jpeg_destroy_decompress(&cinfo);
        fclose(infile);
        return -2;
        }

        jpeg_stdio_src(&cinfo, infile);
        (void) jpeg_read_header(&cinfo, TRUE);
        wymiary[0] = cinfo.image_width;
        wymiary[1] = cinfo.image_height;
        jpeg_destroy_decompress(&cinfo);
        return 0;
}
int read_jpeg(j_decompress_ptr cinfoptr, unsigned char **image_buffer,int *image_width, int *image_height)
{       JSAMPARRAY jpeg_buffer;
        long int i_buffer, i_image;
        (void) jpeg_start_decompress(cinfoptr);
        *image_buffer = (unsigned char *) malloc(*image_width * *image_height * (*cinfoptr).out_color_components* sizeof(unsigned char));
        if (*image_buffer == NULL) {
        (void) jpeg_finish_decompress(cinfoptr);
        jpeg_destroy_decompress(cinfoptr);
        return -3;
        }
        jpeg_buffer = (*(*cinfoptr).mem->alloc_sarray)((j_common_ptr) cinfoptr, JPOOL_IMAGE,(*cinfoptr).output_width * (*cinfoptr).output_components, 1);
        i_image = 0;
        while ((*cinfoptr).output_scanline < (*cinfoptr).output_height) {
                (void) jpeg_read_scanlines(cinfoptr, jpeg_buffer, 1);
                if ((*cinfoptr).output_components == 3) {
                        for (i_buffer = 0; (unsigned)i_buffer < (*cinfoptr).output_width * (*cinfoptr).output_components; i_buffer++, i_image++)
                        (*image_buffer)[i_image] = jpeg_buffer[0][i_buffer];
                }
        }
        (void) jpeg_finish_decompress(cinfoptr);
        jpeg_destroy_decompress(cinfoptr);
        return 0;
}
int write_jpeg(j_compress_ptr cinfoptr, unsigned char *image_buffer,int quality, int image_width, int image_height)
{   JSAMPROW row_pointer[1];

if (quality < 0) quality = 0; else if(quality > 100) quality = 100;
jpeg_set_quality(cinfoptr, quality, FALSE);
jpeg_start_compress(cinfoptr, TRUE);

while ((*cinfoptr).next_scanline < (*cinfoptr).image_height) {
        row_pointer[0] = &image_buffer[(*cinfoptr).next_scanline* image_width * (*cinfoptr).input_components];
        (void) jpeg_write_scanlines(cinfoptr, row_pointer, 1);
        }
jpeg_finish_compress(cinfoptr);
jpeg_destroy_compress(cinfoptr);
return 0;
}

bytea* kompresuj(bytea* obrazek,int zdjwyj_sz, int zdjwyj_w,int stkompr)
{
 int rc;unsigned char *zdjwej,*zdjwyj;
        int zdjwej_w, zdjwej_sz;
        int jakosc,i, j, k, ib, jb; double ratio;
        int rozmiar;
        bytea* zdjwyjwyn;
        /* Dekompresja - ustawianie obiektu cinfo */
        struct jpeg_decompress_struct cinfo;
        struct my_error_mgr jerr;
        /* Kompresja dane do kompresji */
        struct jpeg_compress_struct cinfokompr;
        struct my_error_mgr jerr1;
        /* ------------------------*/
        //typedef void* declspec(dllimport) funkcjaTYP (MemoryContext,Size);
        //HINSTANCE uchwytDLL = LoadLibrary("libecpg.dll");
        //funkcjaTYP *funkcja = (funkcjaTYP*) GetProcAddress(uchwytDLL, "_MemoryContextAlloc");
        jerr.pub.error_exit = my_error_exit;
        cinfo.err = jpeg_std_error(&jerr.pub);
        jpeg_CreateDecompress(&cinfo,JPEG_LIB_VERSION,(size_t)sizeof(cinfo));
        if (setjmp(jerr.setjmp_buffer)) {
        jpeg_destroy_decompress(&cinfo);
        };
        jpeg_stdio_src(&cinfo, (FILE*)obrazek->vl_dat);
        (void) jpeg_read_header(&cinfo, TRUE);

               cinfo.dct_method = JDCT_FLOAT;
               cinfo.scale_denom = 1;
               cinfo.do_block_smoothing = true;
               cinfo.out_color_space = JCS_RGB;
               cinfo.quantize_colors = 0;
               //info.desired_number_of_colors  = wymilosckolbmp;
               cinfo.two_pass_quantize = true;
               cinfo.dither_mode = JDITHER_ORDERED;
                if (zdjwej_sz > zdjwej_w)
                {
                    ratio = zdjwyj_sz / (double)zdjwej_sz;
                    zdjwyj_w = (int)((double)zdjwej_w * ratio);
                }
                 else
                {
                ratio = zdjwyj_w / (double)zdjwej_w;
                zdjwyj_sz = (int)((double)zdjwej_sz * ratio);
                }
                rc = read_jpeg(&cinfo, &zdjwej ,&zdjwej_sz, &zdjwej_w);
                if (rc != 0) {jpeg_destroy_decompress(&cinfo);}
                else
                {
                zdjwyj = (unsigned char*)malloc(zdjwyj_sz * zdjwyj_w *cinfo.output_components * sizeof(unsigned char));
                for (j = 0; j < zdjwyj_w; j++)
                {
                jb = (int)((double)j / ratio);
                        for (i = 0; i < zdjwyj_sz; i++)
                        {
                        ib = (int)((double)i / ratio);
                                for (k = 0; k < 3; k++)    zdjwyj[(j * zdjwyj_sz + i) * 3 + k]= zdjwej[(jb * zdjwej_sz + ib) * 3 + k];
                        }
                }
                free(zdjwej);
                jerr1.pub.error_exit = my_error_exit;
                cinfokompr.err = jpeg_std_error(&jerr1.pub);
                jpeg_create_compress(&cinfokompr);
                //zdjwyjwyn = (bytea*) palloc(sizeof(bytea));
                jpeg_stdio_dest(&cinfokompr, (FILE*)zdjwyjwyn->vl_dat);

                        cinfokompr.image_width = zdjwyj_sz;
                        cinfokompr.image_height = zdjwyj_w;
                        cinfokompr.in_color_space = JCS_RGB;
                        jpeg_set_defaults(&cinfokompr);
                        cinfokompr.dct_method = JDCT_FLOAT;
                        jpeg_set_linear_quality(&cinfokompr, 80,0);
                        cinfokompr.smoothing_factor = 20;
  
                rc = write_jpeg(&cinfokompr,zdjwyj,stkompr,zdjwyj_sz, zdjwyj_w);
                free(zdjwyj);
                if (rc!= 0) return NULL ;
                return zdjwyjwyn;
               }
               return NULL;
}
--------------------------------------


But linker threw such errors:
"
Unresolved External: _pgwin32_fopen referended from .... // and so on
Unresolved External: _pg_sprintfl referended from .... // and so on "

Why???? I have included postgres.h , and all other required files .
I tried to build almost the same code but in C++ style DLL.
DLL file was created succesfully , but on the other hand postgreSQL couldn't find exported function...
DLL was in non-undernstadable format for postgresql.

Is it fault of windows??? Have I to use Cygwin , and cygwin include  and library files to  successfully  build this function??
Ahh , function has to be called by a Trigger ...

Can you advice me some solution???




Maciej Grygorcewicz
maciekgrygorcewicz <at> gmail.com ,
prometeusz1 <at> o2.pl
GG 1638280


--
Pozdrawiam

Maciej Grygorcewicz
maciekgrygorcewicz <at> gmail.com ,
prometeusz1 <at> o2.pl
GG 1638280
Patrik Forsman | 3 Dec 22:05
Favicon

Whats this? Forum?Support?

Hello 

I am searching for installation support for postgresql. I have tried to delete and reinstall but it only
comes upp error (wrong password or something) Is it possible to delte and reinstall? But at first I have to
know where to look for answers. 

Kind regards 

Patrik Forsman

...................................................................
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Paul Brasseur | 24 Jun 20:24

Installation Problem


Hello:

         I  am attempting to install Postgresql on a system running WINXP.

         I start the cygserver and then give the initdb command in 
the installation documentation. It just generates a series of Bad 
System Calls Error Messages,
as it calls postgres.exe.

         I have had no problem with the Installation of Emacs, Vim, 
Apache, Perl, or Python.

         Any Suggestions why PGSQL will not install ?

Regards,
Paul Brasseur
(Victoria, B.C.
Canada )  

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Paul Brasseur | 24 Jun 20:16

Installation Problem


Hello:

         I  am attempting to install Postgresql on a system running WINXP.

         I start the cygserver and then give the initdb command in 
the installation documentation. It just generates a series of Bad 
System Calls Error Messages,
as it calls postgres.exe.

         I have had no problem with the Installation of Emacs, Vim, 
Apache, Perl, or Python.

         Any Suggestions why PGSQL will not install ?

Regards,
Paul Brasseur
(Victoria, B.C.
Canada ) 

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

telman shahbazov | 18 May 12:36
Picon

Installation problem / cygwin/postgresql/windows

Hi,

I am new in cygwin and postgresql.
Could you please advice how to solve the following problem?

I follow the instructions presented in

http://www.postgresql.org/docs/faqs.FAQ_CYGWIN.html

During the installation I have a problem with

initdb -D -W -E LATIN1
The
/usr/local/pgsql/data is created but by the end of process it is removed
 
SERVER SIDE:

Your group name is currently "mkgroup_l_d". This indicates that not
all domain users and groups are listed in the /etc/passwd and
/etc/group files.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l -d > /etc/passwd
mkgroup  -l -d > /etc/group

This message is only displayed once (unless you recreate /etc/group)
and can be safely ignored.

tsahbaz <at> T-SAHBAZOGLU ~
$ /usr/sbin/cygserver &
[1] 2956

tsahbaz <at> T-SAHBAZOGLU ~
$ cygserver: Initialization complete.  Waiting for requests.

 

 

 

Another window on the same comp:

tsahbaz <at> T-SAHBAZOGLU ~
$ /usr/sbin/initdb -D /usr/local/pgsql/data -W -E LATIN1
The files belonging to this database system will be owned by user "tsahbaz".
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory /usr/local/pgsql/data ... ok
creating directory /usr/local/pgsql/data/global ... ok
creating directory /usr/local/pgsql/data/pg_xlog ... ok
creating directory /usr/local/pgsql/data/pg_xlog/archive_status ... ok
creating directory /usr/local/pgsql/data/pg_clog ... ok
creating directory /usr/local/pgsql/data/pg_subtrans ... ok
creating directory /usr/local/pgsql/data/base ... ok
creating directory /usr/local/pgsql/data/base/1 ... ok
creating directory /usr/local/pgsql/data/pg_tblspc ... ok
selecting default max_connections ... sh: line 1:   260 Bad system call
"/usr/sbin/postgres.exe" -boot -x0 -F -c shared_buffers=500 -c max_connections=1
00 template1 < "/dev/null" > "/dev/null" 2>&1
sh: line 1:  2696 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=250 -c max_connections=50 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  3804 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=200 -c max_connections=40 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  3856 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=150 -c max_connections=30 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  2588 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=100 -c max_connections=20 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  2668 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=50 -c max_connections=10 template1 < "/dev/null" > "/dev/null"
 2>&1
10
selecting default shared_buffers ... sh: line 1:  2532 Bad system call         "
/usr/sbin/postgres.exe" -boot -x0 -F -c shared_buffers=1000 -c max_connections=1
0 template1 < "/dev/null" > "/dev/null" 2>&1
sh: line 1:  2228 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=900 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  2192 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=800 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  1760 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=700 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  3160 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=600 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  3828 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=500 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:   836 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=400 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  2488 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=300 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  2396 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=200 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  3488 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=100 -c max_connections=10 template1 < "/dev/null" > "/dev/null
" 2>&1
sh: line 1:  1880 Bad system call         "/usr/sbin/postgres.exe" -boot -x0 -F
-c shared_buffers=50 -c max_connections=10 template1 < "/dev/null" > "/dev/null"
 2>&1
50
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... child process wa
s terminated by signal 12
initdb: removing data directory "/usr/local/pgsql/data"

tsahbaz <at> T-SAHBAZOGLU ~
$

Regards,

Telman Shahbazov

 


Gmane