INSERT INTO arr2(array[1].d, array[2].d)

From: Jim Nasby <jim(dot)nasby(at)openscg(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: INSERT INTO arr2(array[1].d, array[2].d)
Date: 2017-03-11 20:43:55
Message-ID: 5088ce6e-fa81-1e36-d130-813e73f5939a@openscg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Over in [1], I was very surprised to discover $SUBJECT[2]. I looked in
the docs, and they clearly indicate that INSERT accepts "column names".

What's the best way to describe this? "column expression"? "field
expression"?

1:
https://www.postgresql.org/message-id/20170311005810.kuccp7t5t5jhe736@alap3.anarazel.de

2:
CREATE TABLE arr(d int[]);
CREATE TABLE arr2(arr arr)
INSERT INTO arr2(arr[1].d, arr[2].d) VALUES(ARRAY[1,2],ARRAY[3,4])
RETURNING *
┌───────────────────────────────┐
│ arr │
├───────────────────────────────┤
│ {"(\"{1,2}\")","(\"{3,4}\")"} │
└───────────────────────────────┘
--
Jim Nasby, Chief Data Architect, OpenSCG
http://OpenSCG.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-03-11 20:52:04 Re: How to get the 'ctid' from a record type?
Previous Message Bruce Momjian 2017-03-11 20:37:00 Re: [HACKERS] Small issue in online devel documentation build