From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | Hristo Ivanov <hristo(dot)atanassov(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: information_schema.check_constraints Inconsistencies |
Date: | 2018-09-18 19:59:10 |
Message-ID: | 87fty6io5z.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
>>>>> "Hristo" == Hristo Ivanov <hristo(dot)atanassov(at)gmail(dot)com> writes:
Hristo> Hello,
Hristo> I am writing with regards to some wrong results I keep on
Hristo> receiving when using check_constraints view from
Hristo> information_schema:
Hristo> (1) First, it shows constraints grouped by name, regardless of
Hristo> the relation used: when having two constraints with the same
Hristo> name in different tables, it shows both in both tables,
Hristo> regardless of their belonging;
In the SQL spec, the name of a constraint is not local to the table; in
a given schema, the name must be unique. PostgreSQL does not enforce
this, and generally treats constraint names as local to a single
_table_; this is difficult to fix retroactively because it would make
old databases fail to restore if the spec's conditions were enforced.
https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL_Standard#Constraint_name_scope
Hristo> (2) Second, it also lists NOT NULL constraints, even though
Hristo> they are not created as check constraints.
This is required by the SQL spec, which treats NOT NULL as merely a
syntactic shorthand for CHECK(colname IS NOT NULL). But see also
which implies that for composite-type columns, NOT NULL and
CHECK(colname IS NOT NULL) actually have different semantics in PG.
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2018-09-19 06:10:02 | Re: BUG #15350: Getting invalid cache ID: 11 Errors |
Previous Message | David G. Johnston | 2018-09-18 19:28:10 | Re: information_schema.check_constraints Inconsistencies |