Re: "RETURNING PRIMARY KEY" syntax extension

From: Ian Barwick <ian(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: Tom Dunstan <pgsql(at)tomd(dot)cc>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "RETURNING PRIMARY KEY" syntax extension
Date: 2014-07-03 01:02:05
Message-ID: 53B4AB8D.3020507@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/07/14 15:16, Ian Barwick wrote:
> On 14/07/01 23:13, Robert Haas wrote:
>> On Tue, Jul 1, 2014 at 8:00 AM, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> wrote:
>>> .) In map_primary_key_to_list() patch using INDEX_ATTR_BITMAP_IDENTITY_KEY
>>> bitmap to get the keycols. In IndexAttrBitmapKind there is also
>>> INDEX_ATTR_BITMAP_KEY, so was confuse between INDEX_ATTR_BITMAP_KEY and
>>> INDEX_ATTR_BITMAP_IDENTITY_KEY and also haven't found related comments in
>>> the code. Later with use of testcase and debugging found confirmed that
>>> INDEX_ATTR_BITMAP_IDENTITY_KEY only returns the Primary key.
>>
>> Actually, that depends on how REPLICA IDENTITY is set. IOW, you can't
>> assume that will give you the primary key.
>
> Damn, fooled by the name. Thanks for the info; I'll rework the patch
> accordingly.

Attached version implements an IndexAttrBitmapKind "INDEX_ATTR_BITMAP_PRIMARY_KEY",
which will return the primary key column(s). Note this would require a catalog
version bump.

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
returning_primary_key.cf3.patch text/x-patch 30.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Barwick 2014-07-03 01:26:41 Re: "RETURNING PRIMARY KEY" syntax extension
Previous Message Peter Geoghegan 2014-07-03 00:24:06 Re: Stating the significance of Lehman & Yao in the nbtree README