Re: DEFERRABLE NOT NULL constraint
Albe Laurenz <laurenz.albe@wien.gv.at>
From: Albe Laurenz <laurenz.albe@wien.gv.at>
To: "Gavan Schneider *EXTERN*" <pg-gts@snkmail.com>, "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
Date: 2013-02-08T13:25:58Z
Lists: pgsql-general
Gavan Schneider wrote:
> And this leads to a thought. Why is it that in this chapter the
> documentation gives a synopsis which is not correct for the
> current implementation but relies on a negation much further
> down the page to properly describe the actual behaviour?
The synopsis gives the syntax diagram, that is, what you must
type to avoid a syntax error.
Not every syntactically correct statement is also correct.
Some examples:
test=> CREATE TABLE test (id integer PRIMARY KEY, val text NOT NULL USING DEFERRABLE);
ERROR: syntax error at or near "USING"
LINE 1: ...E test (id integer PRIMARY KEY, val text NOT NULL USING DEFE...
^
A syntax error.
test=> CREATE TABLE test (id integer PRIMARY KEY, val text NOT NULL DEFERRABLE);
ERROR: misplaced DEFERRABLE clause
LINE 1: ...E test (id integer PRIMARY KEY, val text NOT NULL DEFERRABLE...
^
A syntactically correct statement that is nontheless incorrect.
test=> CREATE TABLE test (id integer PRIMARY KEY, val integer DEFAULT 'y');
ERROR: invalid input syntax for integer: "y"
The same.
Yours,
Laurenz Albe