Re: [GENERAL] C Function Question

2009-07-28 Thread Terry Lee Tucker
On Tuesday 28 July 2009 03:22, Albe Laurenz wrote: > Terry Lee Tucker wrote: > > Does anyone know if a function written in C and linked into the backend > > in a shared library with a statically declared structure, maintain that > > data for the life of the backend process such that, when the funct

Re: [GENERAL] C Function Question

2009-07-28 Thread Albe Laurenz
Terry Lee Tucker wrote: > Does anyone know if a function written in C and linked into the backend in a > shared library with a statically declared structure, maintain that data for > the life of the backend process such that, when the function is called again, > the structure data is intact? >

[GENERAL] C Function Question

2009-07-27 Thread Terry Lee Tucker
Greetings: Does anyone know if a function written in C and linked into the backend in a shared library with a statically declared structure, maintain that data for the life of the backend process such that, when the function is called again, the structure data is intact? Thanks for any insight

Re: [GENERAL] C function question

2009-02-04 Thread Merlin Moncure
On Tue, Feb 3, 2009 at 6:16 PM, Tom Lane wrote: > Merlin Moncure writes: >> On Tue, Feb 3, 2009 at 4:28 PM, Tom Lane wrote: >>> You know, maybe we should stop holding our noses and do something about >>> this old gotcha. That type's not going away anytime soon, but could we >>> rename it to cha

Re: [GENERAL] C function question

2009-02-04 Thread Gregory Stark
Tom Lane writes: > Alvaro Herrera writes: >> Grzegorz Jaśkiewicz wrote: >>> looks like it really has to be defined with "char" in double quotes. I >>> thought just char is enough... > >> They're different types. > > You know, maybe we should stop holding our noses and do something about > this

Re: [GENERAL] C function question

2009-02-03 Thread Tom Lane
Merlin Moncure writes: > On Tue, Feb 3, 2009 at 4:28 PM, Tom Lane wrote: >> You know, maybe we should stop holding our noses and do something about >> this old gotcha. That type's not going away anytime soon, but could we >> rename it to char1 or something like that? (With some sort of backward

Re: [GENERAL] C function question

2009-02-03 Thread Grzegorz Jaśkiewicz
On Tue, Feb 3, 2009 at 9:28 PM, Tom Lane wrote: > On the other hand, that might be more trouble than it's worth. Even > with a domain alias, there'd be a nontrivial chance of breaking apps > that look at the char columns of the system catalogs. I have to apologize, it is clearly written in quo

Re: [GENERAL] C function question

2009-02-03 Thread Grzegorz Jaśkiewicz
looks like it really has to be defined with "char" in double quotes. I thought just char is enough... -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] C function question

2009-02-03 Thread Merlin Moncure
On Tue, Feb 3, 2009 at 4:28 PM, Tom Lane wrote: > Alvaro Herrera writes: >> Grzegorz Jaśkiewicz wrote: >>> looks like it really has to be defined with "char" in double quotes. I >>> thought just char is enough... > >> They're different types. > > You know, maybe we should stop holding our noses a

Re: [GENERAL] C function question

2009-02-03 Thread Grzegorz Jaśkiewicz
it's defined: create or replace function filter_text(text, char) returns text as 'test_proc.so' language 'c'; which leads me to another question. It seems that I have to leave psql and comeback, for new version to be loaded. (that's on 8.4 tho, I don't have 8.3 at home). And also that 'replace'

Re: [GENERAL] C function question

2009-02-03 Thread Tom Lane
Alvaro Herrera writes: > Grzegorz Jaśkiewicz wrote: >> looks like it really has to be defined with "char" in double quotes. I >> thought just char is enough... > They're different types. You know, maybe we should stop holding our noses and do something about this old gotcha. That type's not go

Re: [GENERAL] C function question

2009-02-03 Thread Alvaro Herrera
Grzegorz Jaśkiewicz wrote: > looks like it really has to be defined with "char" in double quotes. I > thought just char is enough... They're different types. -- Alvaro Herrera http://www.flickr.com/photos/alvherre/ "Crear es tan difícil como ser libre" (Elsa Triolet) --

Re: [GENERAL] C function question

2009-02-03 Thread Tom Lane
Alvaro Herrera writes: > Grzegorz Jaśkiewicz wrote: >> for whatever reason, taht doesn't return the real char that was passed in. > Yeah ... try DatumGetBpCharP instead. PG_GETARG_CHAR is for type "char" > with quotes, which is a completely different thing. Or maybe the C code does just what h

Re: [GENERAL] C function question

2009-02-03 Thread Alvaro Herrera
Grzegorz Jaśkiewicz wrote: > > char c = PG_GETARG_CHAR(1); > > for whatever reason, taht doesn't return the real char that was passed in. Yeah ... try DatumGetBpCharP instead. PG_GETARG_CHAR is for type "char" with quotes, which is a completely different thing. -- Alvaro Herrera Valdiv

Re: [GENERAL] C function question

2009-02-03 Thread Grzegorz Jaśkiewicz
> char c = PG_GETARG_CHAR(1); > for whatever reason, taht doesn't return the real char that was passed in. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] C function question

2009-02-03 Thread Grzegorz Jaśkiewicz
Hey folks I am trying to write simple function, that would filter out a char from text/string. It's being a while since I last time wrote c function for postgresql (8.1), and few things are gone in API there. Can someone tell me what's wrong with that function please ? #include "postgres.h" #inclu