pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedFail of a return query from plpgsql function for a specific table
2+ messages / 2 participants
[nested] [flat]
* Fail of a return query from plpgsql function for a specific table
@ 2009-01-07 21:17 c k <shreeseva.learning@gmail.com>
2009-01-08 07:50 ` Re: Fail of a return query from plpgsql function for a specific table A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 1 reply; 2+ messages in thread
From: c k @ 2009-01-07 21:17 UTC (permalink / raw)
To: pgsql-admin; pgsql-general@postgresql.org
Hi all,I have a table accgroups and many others. I have written a test
function as follows.
CREATE OR REPLACE FUNCTION uf_testfunction()
RETURNS SETOF associates AS
$BODY$
begin
return query select * from associates;
return;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
This works fine for above table but not works at all for accgroups table. As
I searched for this over web, it is identified as a bug for tables whose
columns are changed(deleted and added). Is it true?
How to solve this issue?
Thanks
CPK
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Fail of a return query from plpgsql function for a specific table
2009-01-07 21:17 Fail of a return query from plpgsql function for a specific table c k <shreeseva.learning@gmail.com>
@ 2009-01-08 07:50 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 0 replies; 2+ messages in thread
From: A. Kretschmer @ 2009-01-08 07:50 UTC (permalink / raw)
To: pgsql-general@postgresql.org
In response to c k :
> Hi all,
> I have a table accgroups and many others. I have written a test function as
> follows.
> CREATE OR REPLACE FUNCTION uf_testfunction()
> RETURNS SETOF associates AS
> $BODY$
> begin
> return query select * from associates;
> return;
> end;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
> This works fine for above table but not works at all for accgroups table. As I
> searched for this over web, it is identified as a bug for tables whose columns
> are changed(deleted and added). Is it true?
> How to solve this issue?
> Thanks
> CPK
I can't reproduce your problem:
test=# create table foo (a int, b int);
CREATE TABLE
test=# create or replace function get_foo() returns setof foo as $$begin return query select * from foo; return; end; $$ LANGUAGE 'plpgsql' VOLATILE;
CREATE FUNCTION
test=# select * from get_foo();
a | b
---+---
(0 rows)
test=# alter table foo add column c int;
ALTER TABLE
test=# select * from get_foo();
a | b | c
---+---+---
(0 rows)
(only if i drop a column):
test=# alter table foo drop column c;
ALTER TABLE
test=# select * from get_foo();
ERROR: structure of query does not match function result type
CONTEXT: PL/pgSQL function "get_foo" line 1 at RETURN QUERY
Please, provide us an example including the error you got.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2009-01-08 07:50 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 21:17 Fail of a return query from plpgsql function for a specific table c k <shreeseva.learning@gmail.com>
2009-01-08 07:50 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox