Lists: | pgsql-general |
---|
From: | "Mikael Carneholm" <Mikael(dot)Carneholm(at)WirelessCar(dot)com> |
---|---|
To: | "'Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Hanging creating of function |
Date: | 2005-11-09 18:38:53 |
Message-ID: | 7F10D26ECFA1FB458B89C5B4B0D72C2B088204@sesrv12.wirelesscar.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
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
-- tblname param has type varchar
create or replace function getcolstring (tblname varchar) returns varchar as $$
declare
table_columns varchar := '';
column_name record;
begin
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;
-- chop the last ','
table_columns := substr(table_columns,1,(length(table_columns)-1));
return table_columns;
end;
$$
language plpgsql;
-- tblname param has type text
create or replace function getcolstring (tblname text) returns varchar as $$
declare
table_columns varchar := '';
column_name record;
begin
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;
-- chop the last ','
table_columns := substr(table_columns,1,(length(table_columns)-1));
return table_columns;
end;
$$
language plpgsql;
/Mikael
From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Mikael Carneholm <Mikael(dot)Carneholm(at)WirelessCar(dot)com> |
Cc: | "'Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Hanging creating of function |
Date: | 2005-11-09 18:55:45 |
Message-ID: | 20051109185545.GA42430@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
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
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Mikael Carneholm" <Mikael(dot)Carneholm(at)WirelessCar(dot)com> |
Cc: | "'Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Hanging creating of function |
Date: | 2005-11-09 19:02:16 |
Message-ID: | 18210.1131562936@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
"Mikael Carneholm" <Mikael(dot)Carneholm(at)WirelessCar(dot)com> writes:
> Can anyone explain why the first one never completes, but the second
> one does?
They both work fine for me ...
regards, tom lane