Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDFch-00033x-4i for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jul 2015 17:28:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZDFcg-0005R1-5J for pgsql-sql@arkaria.postgresql.org; Thu, 09 Jul 2015 17:28:34 +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 1ZDFcc-0005Lw-HO for pgsql-sql@postgresql.org; Thu, 09 Jul 2015 17:28:30 +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 1ZDFcZ-0004BT-BC for pgsql-sql@postgresql.org; Thu, 09 Jul 2015 17:28:29 +0000 Received: from [127.0.0.1] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id D3E4221C23E9; Thu, 9 Jul 2015 20:28:26 +0300 (MSK) Message-ID: <559EAF3B.9070900@postgrespro.ru> Date: Thu, 09 Jul 2015 20:28:27 +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: "David G. Johnston" CC: "pgsql-sql@postgresql.org" Subject: Re: Strange DOMAIN behavior References: <559E470F.6020002@postgrespro.ru> <559E80E0.8000002@postgrespro.ru> <559EA470.40201@postgrespro.ru> In-Reply-To: Content-Type: multipart/alternative; boundary="------------030701010909060401080901" X-Antivirus: avast! (VPS 150709-1, 09.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 This is a multi-part message in MIME format. --------------030701010909060401080901 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 09.07.2015 19:50, David G. Johnston wrote: > On Thu, Jul 9, 2015 at 12:42 PM, Alex Ignatov > >wrote: > > DROP FUNCTION lexema_test( ); > CREATE OR REPLACE FUNCTION lexema_test() > RETURNS VOID AS $body$ > DECLARE > lex lexema :=new_lexema(); > BEGIN > END; > $body$ > LANGUAGE PLPGSQL > SECURITY DEFINER; > > Then I got: > ERROR: default value for row or record variable is not supported > LINE 17: lex lexema :=new_lexema(); > > > > > ​Undocumented limitation :( > > While slightly more verbose you simply need to: > > DECLARE lex lexema; > BEGIN > lex := new_lexema(); > [...] > > David J. > Thats sad =(. But it is not so gracefully to initialize composite type in the begin block as it would be in declare block %). Thank you for yours answers! -- 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 --------------030701010909060401080901 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

On 09.07.2015 19:50, David G. Johnston wrote:
On Thu, Jul 9, 2015 at 12:42 PM, Alex Ignatov <a.ignatov@postgrespro.ru> wrote:
DROP FUNCTION lexema_test( );
CREATE OR REPLACE FUNCTION lexema_test()
   RETURNS VOID AS $body$
DECLARE
   lex lexema :=new_lexema();
BEGIN
END;
$body$
LANGUAGE PLPGSQL
SECURITY DEFINER;

Then I got:
ERROR:  default value for row or record variable is not supported
LINE 17:    lex lexema :=new_lexema();



​Undocumented limitation :(

While slightly more verbose you simply need to:

DECLARE lex lexema;
BEGIN
lex := new_lexema();
[...]

David J.

Thats sad =(. But it is not so gracefully to initialize composite type in the begin block as it would be in declare block %).
Thank you for yours answers!
-- 
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com


--------------030701010909060401080901--