Re: Hanging creating of function - Mailing list pgsql-general

From Mikael Carneholm
Subject Re: Hanging creating of function
Date
Msg-id 7F10D26ECFA1FB458B89C5B4B0D72C2B088205@sesrv12.wirelesscar.com
Whole thread Raw
In response to Hanging creating of function  ("Mikael Carneholm" <Mikael.Carneholm@WirelessCar.com>)
Responses Re: Hanging creating of function
List pgsql-general
Postgres machine OS: RHEL release 2.1 (Panama)
PGAdminIII client OS: WinXP Pro 2002 SP2
Clients: psql, PGAdminIII Query tool

dfol=> select version();
                           version
-------------------------------------------------------------
 PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC 2.96


The original versions looked like this (same behaviour though):

create or replace function dfol.getcolstring (tblname varchar) returns varchar as $$
declare
       table_columns text;
       column_name record;
begin
     -- skapa kolumnnamns-strängarna
     for column_name in select pga.attname from pg_attribute pga, pg_class pgc
         where pga.attrelid = pgc.relfilenode and pgc.relname = tblname and pga.attnum > 0 loop
         table_columns := table_columns || column_name.attname || ',';
     end loop;

     -- kapa av sista kommatecknet
     table_columns := substring(table_columns from 1 for length(table_columns)-1);

     return table_columns;

end;
$$
language plpgsql;


create or replace function dfol.getcolstring (tblname text) returns varchar as $$
declare
       table_columns text;
       column_name record;
begin
     -- skapa kolumnnamns-strängarna
     for column_name in select pga.attname from pg_attribute pga, pg_class pgc
         where pga.attrelid = pgc.relfilenode and pgc.relname = tblname and pga.attnum > 0 loop
         table_columns := table_columns || column_name.attname || ',';
     end loop;

     -- kapa av sista kommatecknet
     table_columns := substring(table_columns from 1 for length(table_columns)-1);

     return table_columns;

end;
$$
language plpgsql;



-----Original Message-----
From: Michael Fuhr [mailto:mike@fuhr.org]
Sent: den 9 november 2005 19:56
To: Mikael Carneholm
Cc: 'Pgsql-General (E-mail)
Subject: Re: [GENERAL] Hanging creating of function


On Wed, Nov 09, 2005 at 07:38:53PM +0100, Mikael Carneholm wrote:
> Can anyone explain why the first one never completes, but the second
> one does? (the first one just keeps running, I canceled after ~1 min)
>
> PG version: 8.1 final

Both functions create fine here in 8.1.0 on FreeBSD 6.0/i386 and
Solaris 9/sparc.  What client are you using?  If not psql, have
you tried with psql?  What platform are you on?

--
Michael Fuhr

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Foreign key reference causes invalid DELETE trigger calls
Next
From: Devrim GUNDUZ
Date:
Subject: Re: libpq version in rpm packages