Re: [HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Ok, that worked! Thank you very much, Jan and others who gave their input. I did see Tom's input for the VARHDRSZ and tried that, but forgot to add that again when I called VARATT_SIZEP Jan UrbaƄski wrote: Tim Hawes wrote: @Jan: It appears the cstring_to_text function is unique t

Re: [HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Thank you for your replies, however, it still is not working, see below... Andrew Chernow wrote: Tim Hawes wrote: text * pl_masterkey(PG_FUNCTION_ARGS) { char *e_var = getenv("PGMASTERKEY"); size_t length = VARSIZE(e_var) - VARHDRSZ; The VARSIZE macro is for variable length

[HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Hello all, I am trying to write an extension in C that returns a simple environment variable. The code compiles without any complaint or warning, and it loads fine into the database, however, when I run the function, I get disconnected from the server. Here is my C code: #include #include