Re: PL/pgSQL 1.2 - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: PL/pgSQL 1.2
Date
Msg-id CAFj8pRDizHM1PdbTsOSxm04EzZWOicnES77Txb+_7-1fvGVzWA@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL 1.2  (Jan Wieck <jan@wi3ck.info>)
Responses Re: PL/pgSQL 1.2  (Jan Wieck <jan@wi3ck.info>)
Re: PL/pgSQL 1.2  (Joel Jacobson <joel@trustly.com>)
Re: PL/pgSQL 1.2  (Joel Jacobson <joel@trustly.com>)
List pgsql-hackers



2014-09-04 15:24 GMT+02:00 Jan Wieck <jan@wi3ck.info>:
On 09/04/2014 01:14 AM, Pavel Stehule wrote:
2014-09-03 23:19 GMT+02:00 Hannu Krosing <hannu@2ndquadrant.com
    A more SQL-ish way of doing the same could probably be called COMMAND
    CONSTRAINTS
    and look something like this

    SELECT
    ...
    CHECK (ROWCOUNT BETWEEN 0 AND 1);


It is very near to my proposed ASSERT

Only if the ASSERT syntax would become part of the original statement, it is supposed to check. In Hannu's command constraint example above, the statement that causes the error, and thus will be logged and become identified by the error message, is the actual SELECT (or other DML statement).

this is valid argument.

On second hand, I proposed a ASSERT that was not based on expressions only. There is not a technical issue to write assert with knowledge of related statement.
 

I think I like the COMMAND CONSTRAINT the best so far.

I not, because when it will not be part of SQL, than parser in plpgsql will be more complex. You have to inject SELECT, UPDATE, INSERT, DELETE

Pavel
 


Regards,
Jan

--
Jan Wieck
Senior Software Engineer
http://slony.info

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: missing tab-completion for relation options
Next
From: Robert Haas
Date:
Subject: Re: Escaping from blocked send() reprised.