BUG #3314: DOMAIN NOT NULL constraint enforced in plPgSQL DECLARE clause.

From: "Dmitry Maksyoma" <ledestin(at)amur(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3314: DOMAIN NOT NULL constraint enforced in plPgSQL DECLARE clause.
Date: 2007-05-28 13:41:37
Message-ID: 200705281341.l4SDfb77074009@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3314
Logged by: Dmitry Maksyoma
Email address: ledestin(at)amur(dot)ru
PostgreSQL version: 8.2.4-1 Debian
Operating system: Debian unstable, 2.6.18-4-686
Description: DOMAIN NOT NULL constraint enforced in plPgSQL DECLARE
clause.
Details:

Had to modify postgresql.conf to listen on localhost.

su postgres
createdb test
createlang plPgSQL test
psql test

CREATE SCHEMA test;

CREATE DOMAIN test.text_not_null AS TEXT NOT NULL;

CREATE TABLE test.test_domain ( name test.text_not_null);
CREATE TABLE test.test_text ( t TEXT NOT NULL);

CREATE OR REPLACE FUNCTION test.get_domain()
RETURNS TEXT STABLE LANGUAGE plPgSQL AS '
DECLARE
row test.test_domain%ROWTYPE;
BEGIN
RETURN ''HELLO'';
END;';

CREATE OR REPLACE FUNCTION test.get_text()
RETURNS TEXT STABLE LANGUAGE plPgSQL AS '
DECLARE
row test.test_text%ROWTYPE;
BEGIN
RETURN ''HELLO'';
END;';

\set VERBOSITY verbose
SELECT test.get_text();
SELECT test.get_domain();

# Test output.

test=# \set VERBOSITY verbose
test=# SELECT test.get_text();
get_text
----------
HELLO
(1 row)

test=# SELECT test.get_domain();
ERROR: 23502: domain test.text_not_null does not allow null values
CONTEXT: PL/pgSQL function "get_domain" line 3 at block variables
initialization
LOCATION: domain_check_input, domains.c:128

First, it used to work without error in Postgres 7.4. Second, it is, from my
point of view, inconsistent to have the same constraint to be enforced in
case of DOMAIN type and not enforced in case of columnt constraint.

Browse pgsql-bugs by date

  From Date Subject
Next Message Balachandran 2007-05-28 15:27:27 BUG #3315: Cannot configure XP over Static IP
Previous Message Stefan Kaltenbrunner 2007-05-28 09:56:54 Re: BUG #3309: The limitation for number of connection with ODBC driver