Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2012-07-13 Thread eugeniotapias
HI, El viernes, 2 de julio de 2010 10:26:43 UTC-3, (desconocido) escribió: Hello, I#39;ve got a problem with Functions in C using SPI. Using: PostgreSQL 8.3, Codeblocks, Windows Server 2003 R2 I compiled the file quot;pgExampleSPI.cquot; with the following code without any error:

[GENERAL] C functions with COMMIT/ROLLBACK?

2010-12-26 Thread Elliot Chance
Hi everyone, Is is possible to add handlers so that a C function is fired when a transaction is committed or rolled back, for example (pseudo code): BEGIN; CALL my_function(1); CALL my_function(2); CALL my_function(3); ROLLACK; my_function() Create my_file.txt.tmp Write some information to

Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-05 Thread Saitenheini
Hi people, after a two days break: I could compile the following code with Visual C++ Express 2010 under Windows Server 2003 R2: /* Use 32-bit timer (provided header file uses 64-bit timer, not * compatible with Windows postgreSQL versions */ #define _USE_32BIT_TIME_T #define BUILDING_DLL 1

Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-05 Thread Sam Mason
On Mon, Jul 05, 2010 at 10:20:30AM +0200, saitenhe...@web.de wrote: Datum count_person(PG_FUNCTION_ARGS) { SPI_connect(); int ret = SPI_exec(SELECT count(*) FROM person, 0); SPI_finish(); PG_RETURN_INT32(ret); } But I guess I still did something wrong, because no matter how many rows

Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-03 Thread Martijn van Oosterhout
On Sat, Jul 03, 2010 at 09:35:56AM +0800, Craig Ringer wrote: On 02/07/10 21:26, saitenhe...@web.de wrote: #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif Why the conditional compilation of PG_MODULE_MAGIC? That's the recommendation, so the module compiles on all versions of Postgres.

[GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-02 Thread Saitenheini
Hello,I've got a problem with Functions in C using SPI.Using: PostgreSQL 8.3, Codeblocks, Windows Server 2003 R2I compiled the file "pgExampleSPI.c" with the following code without any error:/* Use 32-bit timer (provided header file uses 64-bit timer, not* compatible with Windows postgreSQL

[GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Saitenheini
Hello, I've got a problem with user defined functions in C using SPI. Using: PostgreSQL 8.3.7, Codeblocks (GNU GCC Compiler), Windows Server 2003 R2 I compiled the file pgExampleSPI.c with the following code without any error: /* Use 32-bit timer (provided header file uses 64-bit timer, not *

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Tom Lane
saitenhe...@web.de writes: I compiled the file pgExampleSPI.c with the following code without any error: /* Use 32-bit timer (provided header file uses 64-bit timer, not * compatible with Windows postgreSQL versions */ #define _USE_32BIT_TIME_T #include postgres.h #include executor\spi.h

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Saitenheini
Thanks for reply Tom! I've tried several version: #define _USE_32BIT_TIME_T #include postgres.h #include fmgr.h #include executor\spi.h /* #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif */ extern Datum count_person (PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(count_person); __declspec(dllexport)

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Joe Conway
On 07/02/2010 08:13 AM, saitenhe...@web.de wrote: Thanks for reply Tom! I've tried several version: #define _USE_32BIT_TIME_T #include postgres.h #include fmgr.h #include executor\spi.h /* #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif */ but still the same error occurs. You

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Saitenheini
Thanks, I've already tried that. I doesn't make any difference. Still the same error. in Visual C++ I can't even compile it, although I set all links and compiler directories like it was told in this post: http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html I don't have more ideas.

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Joe Conway
On 07/02/2010 08:36 AM, saitenhe...@web.de wrote: Thanks, I've already tried that. I doesn't make any difference. Still the same error. in Visual C++ I can't even compile it, although I set all links and compiler directories like it was told in this post:

Re: [GENERAL] C-functions using SPI Missing Magic Block Error

2010-07-02 Thread Saitenheini
I'll try b) and hope I can find a solution. Thanks for your support Joe. Kind Regards, Max. On 07/02/2010 08:36 AM, saitenhe...@web.de wrote: Thanks, I've already tried that. I doesn't make any difference. Still the same error. in Visual C++ I can't even compile it, although I set all

Re: [GENERAL] C-Functions using SPI - Missing Magic Block

2010-07-02 Thread Craig Ringer
On 02/07/10 21:26, saitenhe...@web.de wrote: #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif Why the conditional compilation of PG_MODULE_MAGIC? ERROR: incompatible library G:/PostgreSQL/8.3/lib/pgExampleSPI.dll: missing magic block TIP: Extension libraries are required to use the

Re: [GENERAL] C Functions

2010-04-15 Thread Szymon Guz
2010/4/15 Krzysztof Szewczyk k.szewc...@i-bs.pl Hello All, I wrote c function for postgresql, i compiled it as a shared file, next I added my function to pgadmin everything was ok, but now when i wanna call it the pgadmin is closing with no report. Regards -- Sent via pgsql-general

[GENERAL] C Functions

2010-04-14 Thread Krzysztof Szewczyk
Hello All, I wrote c function for postgresql, i compiled it as a shared file, next I added my function to pgadmin everything was ok, but now when i wanna call it the pgadmin is closing with no report. Regards -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] C functions, dll, server fall down

2009-12-16 Thread AlexeyChe
hm. I wonder if this is confusion between value/reference datums. Can you do a quick check to see exactly where it's crashing (either before you get into the function, at the getarg, or in the return)? you can elog(WARNING, msg) to print out debug info from inside the function. merlin It's

[GENERAL] C functions, dll, server fall down

2009-12-09 Thread AlexeyChe
Hi there Need help, I just took the example from Postgres help, code: #include postgres.h #include fmgr.h #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif PG_FUNCTION_INFO_V1(add_one); __declspec (dllexport) Datum add_one(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0);

Re: [GENERAL] C functions, dll, server fall down

2009-12-09 Thread Merlin Moncure
On Wed, Dec 9, 2009 at 8:33 AM, AlexeyChe alexey.chernus...@gmail.com wrote: Hi there Need help, I just took the example from Postgres help, code: #include postgres.h #include fmgr.h #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif PG_FUNCTION_INFO_V1(add_one); __declspec (dllexport)

Re: [GENERAL] C functions under windows

2007-05-03 Thread Andrei Kovalevski
Islam Hegazy wrote: Hi all I have postgresql server installed on a windows machine and I want to retrieve data using C functions. I followed the steps in the documentation but it didn't work for windows. I created a .dll projects for my functions but postgres.h calls .h files that I can't

Re: [GENERAL] C functions under windows

2007-05-03 Thread Martin Gainty
Andrei- *If you're developing under nix* then I would use windows cygwin (bash shell) e.g. \cygwin\cygwin.bat cd / find . -name strings.h you will see /usr/include but this version of strings.h only includes string.h to bring into environment make sure you include the /usr/include in .profile

Re: [GENERAL] C functions under windows

2007-05-03 Thread Islam Hegazy
- Original Message - From: Andrei Kovalevski [EMAIL PROTECTED] To: pgsql-general@postgresql.org; Islam Hegazy [EMAIL PROTECTED] Sent: Thursday, May 03, 2007 7:32 AM Subject: Re: [GENERAL] C functions under windows Islam Hegazy wrote: Hi all I have postgresql server installed on a windows

Re: [GENERAL] C functions under windows

2007-05-03 Thread Magnus Hagander
Islam Hegazy wrote: I have added the path to the include directory of postgresql but it hasn't already some of the files that are in linux include path like strings.h. It doesn't object about postgres.h which it can find now but it objects about strings.h I use MSVC6 to make my dll file.

[GENERAL] C functions under windows

2007-05-02 Thread Islam Hegazy
Hi all I have postgresql server installed on a windows machine and I want to retrieve data using C functions. I followed the steps in the documentation but it didn't work for windows. I created a .dll projects for my functions but postgres.h calls .h files that I can't find on the windows

Re: [GENERAL] C functions under windows

2007-05-02 Thread Magnus Hagander
Are you building with the same compiler as the backend was built with? If you're using the binary distribution that means mingw unless you're testing the pre-beta snapshot Dave uploaded a few days ago. /Magnus --- Original message --- From: Islam Hegazy [EMAIL PROTECTED] Sent:

Re: [GENERAL] C Functions, datatypes

2004-05-07 Thread Joe Conway
A Palmblad wrote: I'm writing a function in C, and am trying to return a row, containing Numeric and array types. I'm building the row with heap_formtuple. I'm having trouble creating the numeric and array Datums. If anyone has some example code illustrating this, that'd be great. See PL/R for

Re: [GENERAL] C Functions, datatypes

2004-05-04 Thread Karel Zak
On Mon, May 03, 2004 at 12:48:19PM -0700, A Palmblad wrote: I'm writing a function in C, and am trying to return a row, containing Numeric and array types. I'm building the row with heap_formtuple. I'm having trouble creating the numeric and array Datums. If anyone has some example

[GENERAL] C functions

2003-09-05 Thread Franco Bruno Borghesi
Hi guys! I need to migrate some plpgsql functions I have to C language. These functions execute queries and process the results inside, and some of them return records... I've been reading the documentation, but I would like any of you to tell me where can I find some examples of these kind

Re: [GENERAL] C functions

2003-09-05 Thread Peter Eisentraut
Franco Bruno Borghesi writes: I need to migrate some plpgsql functions I have to C language. These functions execute queries and process the results inside, and some of them return records... I've been reading the documentation, but I would like any of you to tell me where can I find some

[GENERAL] C++ functions under Windows

2003-07-01 Thread Yuriy Rusinov
Hello ! I have to develop c++ function for PostgreSQL 7.3.1 under Windows 2000, what compilers and linkers may be used for this purposes ? I have Visual C++ 6.0 and C++Builder 5.0 . May I use them ? Best regards, Sincerely yours, Yuriy Rusinov. ---(end of

[GENERAL] C functions, arguments, and ssh oh my!

2001-03-27 Thread Joel Dudley
Hello All, I am writing my first C function for postgres and failing miserably. my C function needs to get passed a username (char) , uid(int), and gid(int) and what it does with those is builds a command string for an external app that is called with system() and exits 0. I know this is

Re: [GENERAL] C functions, arguments, and ssh oh my!

2001-03-27 Thread Alfred Perlstein
* Joel Dudley [EMAIL PROTECTED] [010327 11:29] wrote: Hello All, I am writing my first C function for postgres and failing miserably. my C function needs to get passed a username (char) , uid(int), and gid(int) and right, wrong and wrong. char *, uid_t, gid_t. -- -Alfred Perlstein -

Re: [GENERAL] C functions, arguments, and ssh oh my!

2001-03-27 Thread Peter Eisentraut
Joel Dudley writes: PG_FUNCTION_INFO_V1(ssh_exec); Datum ssh_exec(PG_FUNCTION_ARGS) { char sshcmd[255]; strncpy(sshcmd, "/usr/local/bin/plsshexec ", 255); strncat(sshcmd, *uname, 255); strncat(sshcmd, " ", 255); strncat(sshcmd, *uid, 255);

Re: [GENERAL] C functions, arguments, and ssh oh my!

2001-03-27 Thread Tom Lane
Joel Dudley [EMAIL PROTECTED] writes: what it does with those is builds a command string for an external app that is called with system() and exits 0. I know this is strange and ugly but I need to trigger this external app when an insert is made into a user table. This seems an extremely