Re: DEFERRABLE NOT NULL constraint

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Gavan Schneider *EXTERN*" <pg-gts(at)snkmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: DEFERRABLE NOT NULL constraint
Date: 2013-02-08 13:25:58
Message-ID: A737B7A37273E048B164557ADEF4A58B057B1301@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karel Riverón 2013-02-08 13:39:05 Decrease the time required function
Previous Message Gavan Schneider 2013-02-08 12:46:35 Re: DEFERRABLE NOT NULL constraint