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

From Jan Wieck
Subject Re: PL/pgSQL 2
Date
Msg-id 540B403B.3020204@wi3ck.info
Whole thread Raw
In response to Re: PL/pgSQL 2  (David G Johnston <david.g.johnston@gmail.com>)
List pgsql-hackers
On 09/06/2014 12:47 PM, David G Johnston wrote:
> ​If the language, and the system as a whole, was only used by
> perfectionists that do not make errors - and with perfectly clean data -
> this adherence to purity would be acceptable.  But the real world is not
> that clean and so enhancing the language to meet the needs of the real
> world is not crippling the language.  Begin able to state explicitly
> that the cardinality of the set I get back must be 1, no more and no
> less, doesn't remove the fact that I know I am dealing with a set and
> that I simply want to make an assertion as to its properties so that if
> a bug 3 layers deep into the application causes something other than 1
> row to be affected I know immediately and can invoke the appropriate
> action - throw an error.

As I already mentioned in the other thread, those assertions or checks 
do not belong into the PL. If they are desired they should be added to 
the main SQL syntax as COMMAND CONSTRAINT like suggested by Hannu.

Your statement is not limited to PL functions. It is just as valid for 
NORMAL applications.

However, this would be a proprietary extension that is not covered by 
any SQL standard and for that reason alone cannot be the default.


Regards,
Jan

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



pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: PL/pgSQL 2
Next
From: Petr Jelinek
Date:
Subject: Re: proposal: plpgsql - Assert statement