Re: PL/pgSQL PERFORM with CTE
От | David E. Wheeler |
---|---|
Тема | Re: PL/pgSQL PERFORM with CTE |
Дата | |
Msg-id | E7ADEE10-DE87-4E58-9967-4BA7366F1390@justatheory.com обсуждение исходный текст |
Ответ на | Re: PL/pgSQL PERFORM with CTE (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: PL/pgSQL PERFORM with CTE
Re: PL/pgSQL PERFORM with CTE |
Список | pgsql-hackers |
On Aug 29, 2013, at 1:11 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote: > I cannot to say what is good design for PL/pgSQL - only I feel so some variant of RETURN statement is not good, becausesemantic is significantly different. And I see a increasing inconsistency between a original ADA and PL/pgSQL. So YIELD or implement PL/PSM. > Sure, When I am thinking about PSM, I am thinking about T-SQL syntax, but there is little bit simpler situation - thereis a precedent in PSM implementation in MySQL and some other new databases. PL/pgSQL is not PSM. > so main problem is a impossibility to write > > BEGIN > CALL fce() > > or > > BEGIN > fce(); > > A workaround in Postgres is PERFORM - and I really has nothing again to remove PERFORM for start of VOID functions! No reason SELECT could not work just a well. > A unhelpful error message has zero relevant to topic - just almost all in PL/pgSQL is SELECT. Well, it was an aside, but points out another problem with PERFORM: It doesn't really exist. I gets replaced with SELECTinternally, leading to confusing error messages. Solution: Allow SELECT instead of PERFORM. > Do you would to remove a ":=" statement too? > > postgres=# do $$declare x int; begin x := notexisting(10); end; $$ ; > ERROR: function notexisting(integer) does not exist > LINE 1: SELECT notexisting(10) > ^ > HINT: No function matches the given name and argument types. You might need to add explicit type casts. > QUERY: SELECT notexisting(10) > CONTEXT: PL/pgSQL function inline_code_block line 1 at assignment I agree it would be nice if it didn't report SELECT there, but at least it's not *removing* anything from what you see inthe source. Best, David
В списке pgsql-hackers по дате отправления: