Re: Insert value input syntax of an array of types without ARRAY/ROW nor casting?

From: Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com>
To: Stefan Keller <sfkeller(at)gmail(dot)com>
Cc: pgsql-general List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert value input syntax of an array of types without ARRAY/ROW nor casting?
Date: 2011-03-19 22:00:05
Message-ID: 43722681-5C87-491B-A310-DF572556721F@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mar 19, 2011, at 9:50 PM, Stefan Keller wrote:

> Unfortunately it still does'nt work. I get
>
> ERROR: wrong record constant: »('a'«
> LINE 2: 5, $${ ('a', 'aa'), ('b', 'bb') }$$ );
> ^
> DETAIL: Unexpected end of line.

Try following, it should work:
INSERT INTO mytypetable VALUES ( 6,ARRAY[row('a', 'aa'), row('b', 'bb')]::mytype[] );

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vibhor Kumar 2011-03-19 22:02:26 Re: How do I do this in plpgsql ?
Previous Message Vincent Veyron 2011-03-19 19:40:33 Re: triggers and FK cascades