Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: Custom C fu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 23 Topic 15452 of 16301
Post > Topic >>

Re: Custom C function - is palloc broken?

by heron@[EMAIL PROTECTED] ("Dan \"Heron\" Myers") May 4, 2008 at 01:02 PM

Craig Ringer wrote:
 > Can you send me a complete, compileable example that illustrates the
 > problem, along with instructions on how to reproduce it? If possible,
 > send a compiled binary and any dependencies too. I'm curious to see if
 > this is in fact shared library issues.

I'll send you a .zip file separately with the actual code, but here are 
the steps I took:

- Install Postgres 8.3.1
- Install MinGW 5.1.4
- Install the gettext snapshot from MinGW's downloads page under
"snapshots"

Then, unzip the zip file I'll send you.  Make sure MinGW's bin directory 
is in your windows PATH environment variable.  In a command prompt, go 
to your unzipped directory and run mingw32-make.  The makefile I've 
included will put the .dll in Postgres' lib/plugins directory (assuming 
you installed postgres in its default location - modify the makefile if 
that is not the case).

Once the .dll is ready, I created the function in Postgres using the 
CREATE FUNCTION command given in the do***entation, modified slightly:

CREATE FUNCTION copytext(text) RETURNS text
      AS '$libdir/plugins/mylib.dll', 'copytext'
      LANGUAGE C STRICT;

Then I used the following SELECT statement:

SELECT copytext(colname) FROM tablename;

where "colname" is a text column in table "tablename".  This statement 
crashes the database server.

I read somewhere on Postgres' website that the win32 binaries were built 
with MinGW - and in fact they must be, since MSVC++ does not have some 
of the unix headers needed to build Postgres.

Your theory could very well be true - especially if the issue is with a 
different version of gettext.  MinGW's website's snapshot is from 2006 
or something, so it wouldn't surprise me if Postgres uses a newer version.

A zip file is attached to a separate e-mail to you.  Anyone else who 
would like a copy may have one, just let me know, but it's basically 
just the copytext example from the tutorials pasted into a .c file, and 
a makefile.

- Dan

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 23 Posts in Topic:
Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-03 21:39:04 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:50:26 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-04 23:52:41 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-04 13:02:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 05:53:27 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-04 21:15:49 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 06:47:11 
Re: Custom C function - is palloc broken?
n8thatcher@[EMAIL PROTECT  2008-05-04 21:53:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-05 15:54:13 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 09:26:22 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 16:57:08 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 18:47:50 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 08:42:16 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 19:42:01 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 10:19:32 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:32:11 
Re: Custom C function - is palloc broken?
craig@[EMAIL PROTECTED]   2008-05-06 12:02:28 
Re: Custom C function - is palloc broken?
heron@[EMAIL PROTECTED]   2008-05-05 20:45:05 
Re: Custom C function - is palloc broken?
jd@[EMAIL PROTECTED] (&q  2008-05-05 20:18:42 
Re: Custom C function - is palloc broken?
tgl@[EMAIL PROTECTED] (T  2008-05-05 22:22:43 
Re: Custom C function - is palloc broken?
magnus@[EMAIL PROTECTED]   2008-05-05 09:07:37 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:46:14 
Re: Custom C function - is palloc broken?
dpage@[EMAIL PROTECTED]   2008-05-06 09:48:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 8:25:31 CDT 2008.