Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZD8ga-0000jE-NF for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jul 2015 10:04:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZD8ga-00023a-70 for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jul 2015 10:04:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZD8gW-00021T-VU for pgsql-sql@postgresql.org; Thu, 09 Jul 2015 10:04:05 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZD8gT-0003rH-7v for pgsql-sql@postgresql.org; Thu, 09 Jul 2015 10:04:04 +0000 Received: from [127.0.0.1] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 6CD4121C2268 for ; Thu, 9 Jul 2015 13:03:59 +0300 (MSK) Message-ID: <559E470F.6020002@postgrespro.ru> Date: Thu, 09 Jul 2015 13:03:59 +0300 From: Alex Ignatov User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Strange DOMAIN behavior Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 150708-1, 08.07.2015), Outbound message X-Antivirus-Status: Clean X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org 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 = 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