duplicated partial-column assigns allowed by checkInsertTargets - Mailing list pgsql-hackers

From Alvaro Herrera
Subject duplicated partial-column assigns allowed by checkInsertTargets
Date
Msg-id 20141204202342.GD26945@alvh.no-ip.org
Whole thread Raw
Responses Re: duplicated partial-column assigns allowed by checkInsertTargets  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-hackers
While perusing checkInsertTargets I noticed that it allows duplicated
assignments to the same member of a composite:

alvherre=# create type f as (a int, b int);
CREATE TYPE
alvherre=# create table t (col f);
CREATE TABLE
alvherre=# insert into t (col.a, col.b, col.a) values (42, 43, 44);
INSERT 0 1
alvherre=# select * from t;  col   
---------(44,43)
(1 fila)


If you instead try a duplicate "col", it is rightfully rejected:

alvherre=# insert into t (col, col) values ((42, 43), (44, 43));
ERROR:  column "col" specified more than once
LÍNEA 1: insert into t (col, col) values ((42, 43), (44, 43));                            ^

Isn't this a bit odd?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [COMMITTERS] pgsql: Support frontend-backend protocol communication using a shm_mq.
Next
From: Alvaro Herrera
Date:
Subject: Re: controlling psql's use of the pager a bit more