agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Alex Ignatov <a.ignatov@postgrespro.ru>
To: pgsql-sql@postgresql.org
Subject: Strange DOMAIN behavior
Date: Thu, 09 Jul 2015 13:03:59 +0300
Message-ID: <559E470F.6020002@postgrespro.ru> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Hello everyone!!!
Got strange DOMAIN behavior in the following plpgsql code:
postgres=# DROP DOMAIN lexema_str CASCADE;
DROP DOMAIN
postgres=# CREATE DOMAIN lexema_str TEXT DEFAULT 'abc';
CREATE DOMAIN
postgres=# DO $$
postgres$# DECLARE
postgres$# lex lexema_str;
postgres$# BEGIN
postgres$# RAISE NOTICE 'lex = %', lex;
postgres$# END;
postgres$# $$;
NOTICE: lex = <NULL>
DO
But i expect that lex = abc!
So default value of DOMAIN type is not set in pgplsql block but:
postgres=# DROP DOMAIN lexema_str CASCADE;
DROP DOMAIN
postgres=# CREATE DOMAIN lexema_str TEXT DEFAULT 'abc' NOT NULL;
CREATE DOMAIN
postgres=# DO $$
postgres$# DECLARE
postgres$# lex lexema_str;
postgres$# BEGIN
postgres$# RAISE NOTICE 'lex = %', lex;
postgres$# END;
postgres$# $$;
ERROR: domain lexema_str does not allow null values
CONTEXT: PL/pgSQL function inline_code_block line 4 during statement
block local variable initialization
So constraints in DOMAIN type work in pgplsql !
Is this correct behavior??
--
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (7+ messages) latest in thread
Message-ID: <559E470F.6020002@postgrespro.ru>
Permalink: ../559E470F.6020002@postgrespro.ru/
Also on: postgresql.org/message-id/559E470F.6020002@postgrespro.ru
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: a.ignatov@postgrespro.ru
Subject: Re: Strange DOMAIN behavior
In-Reply-To: <559E470F.6020002@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox