Re: plan invalidation vs stored procedures
От | Asko Oja |
---|---|
Тема | Re: plan invalidation vs stored procedures |
Дата | |
Msg-id | ecd779860808050708j329d8734ufb9f1a66334012b6@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: plan invalidation vs stored procedures ("Asko Oja" <ascoja@gmail.com>) |
Ответы |
Re: plan invalidation vs stored procedures
|
Список | pgsql-hackers |
postgres=# create or replace function pavel ( i_param text, status OUT int, status_text OUT text ) returns record as $$ select 200::int, 'ok'::text; $$ language sql;
CREATE FUNCTION
postgres=# create or replace function pavel ( i_param text, status OUT int, status_text OUT text, more_text OUT text ) returns record as $$ select 200::int, 'ok'::text, 'tom'::text; $$ language sql;
ERROR: cannot change return type of existing function
DETAIL: Row type defined by OUT parameters is different.
HINT: Use DROP FUNCTION first.
CREATE FUNCTION
postgres=# create or replace function pavel ( i_param text, status OUT int, status_text OUT text, more_text OUT text ) returns record as $$ select 200::int, 'ok'::text, 'tom'::text; $$ language sql;
ERROR: cannot change return type of existing function
DETAIL: Row type defined by OUT parameters is different.
HINT: Use DROP FUNCTION first.
On Tue, Aug 5, 2008 at 5:04 PM, Asko Oja <ascoja@gmail.com> wrote:
> This is simply a bad, wrong, stupid way to do it. Why do you not useI totally agree we should get this fixed first :)
> CREATE OR REPLACE FUNCTION?
postgres=# create or replace function pavel ( i_param text, status OUT int, status_text OUT text ) returns record as $$ select 200::int, 'ok'::text; $$ language sql;
ERROR: cannot change return type of existing function
HINT: Use DROP FUNCTION first.On Tue, Aug 5, 2008 at 4:51 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:Martin Pihlak <martin.pihlak@gmail.com> writes:This is simply a bad, wrong, stupid way to do it. Why do you not use
> create function foo() returns integer as $$ begin return 1; end; $$ language plpgsql;
> CREATE FUNCTION
> prepare c1 as select * from foo();
> PREPARE
> execute c1;
> foo
> -----
> 1
> (1 row)
> drop function foo();
> DROP FUNCTION
> create function foo() returns integer as $$ begin return 2; end; $$ language plpgsql;
> CREATE FUNCTION
> execute c1;
> psql:test.sql:11: ERROR: cache lookup failed for function 36555
CREATE OR REPLACE FUNCTION?
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления: