Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-27 Thread Steve Martin
[EMAIL PROTECTED] wrote: You can do it in straight sql like so. SELECT (array[col1, col2, col3, col4, col5, col6, col7, col8, col9, col10])[i] FROM test t, generate_series(1,10) i Art Hi Art, Thanks for the advice, in my case using arrays was not a option as the data could be null. Stev

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-27 Thread Steve Martin
Klint Gore wrote: Steve Martin wrote: I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. How do you substitute a variable? CREATE OR REPLACE FUNCTION testfunc() RETURNS SETOF text AS $$ DECLARE

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-27 Thread Steve Martin
Roberts, Jon wrote: What I am trying to do is find the difference between two tables, one that stores the information in a single column, and the other which stores the same data in multiple columns. E.g. CREATE TABLE test(col1 text, col2 text, col3 text, col4 text, col5 text,

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Steve Martin wrote: Hi, I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. How do you substitute a variable? Test case: CREATE TABLE test(col1 text, col2 text, col3 text, col4 text, col5 text, col6

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Merlin Moncure wrote: On Wed, Jul 23, 2008 at 4:08 AM, Klint Gore <[EMAIL PROTECTED]> wrote: here is a way to do it with record variables...no inner loop but doesn't the column names. with a little work you could add those with some queries to information_schema (i don't think it's worth it

Re: [GENERAL] Substitute a variable in PL/PGSQL.

2008-07-25 Thread Steve Martin
Hi Francisco, Francisco Reyes wrote: On 12:33 am 07/22/08 Steve Martin <[EMAIL PROTECTED]> wrote: Hi, I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. Are you trying to do a g

[GENERAL] Substitute a variable in PL/PGSQL.

2008-07-22 Thread Steve Martin
Hi, I am trying to create a PL/PGSQL function to return the values of the fields in a record, e.g. 1 value per row in the output of the function. How do you substitute a variable? Test case: CREATE TABLE test(col1 text, col2 text, col3 text, col4 text, col5 text, col6 text, col7 text, col8

Re: [GENERAL] timestamp with time zone output incorrect

2008-04-27 Thread Steve Martin
Tom Lane wrote: Martijn van Oosterhout <[EMAIL PROTECTED]> writes: On Thu, Apr 24, 2008 at 06:30:27PM +1200, Steve Martin wrote: => show timezone ; TimeZone - NZST-12NZDT (1 row) I have no idea what timezone that it. Presumably it switches between

[GENERAL] timestamp with time zone output incorrect

2008-04-26 Thread Steve Martin
timezone/data/australasia" and the information here seems correct. The date on the system (HPUX 11.23) is correct, e.g. % date Thu Apr 24 18:22:42 NZST 2008 % echo $TZ NZST-12NZDT The database seems to know we are using the New Zealand time zone. It seems to think summer is coming it is winte

Re: [GENERAL] PQexec does not return.

2007-01-15 Thread Steve Martin
Hi All, Found the problem. This was caused by a memory leak in our application. Regards Steve Martin Steve Martin wrote: Hi All, We have an intermittent problem where PQexec does not seem to return even though the server seems to have sent the results. From the gdb output , the sql

[GENERAL] PQexec does not return.

2007-01-14 Thread Steve Martin
attname, attnotnull, atttypid, atttypmod, format_ty pe(atttypid, atttypmod) as data_type from pg_attribute where attnum > 0 and atttypid > 0 and attrelid = ( select oid fro m pg_class where relname = 'com_node_host') order by attnum 2007-01-09 00:40:01.097 NZDT [EMAIL PROTECTED]>LOG: duration: 3.788 ms Regards Steve Martin