Re: Support retrieving value from any sequence

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thom Brown <thom(at)linux(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support retrieving value from any sequence
Date: 2015-07-18 00:03:48
Message-ID: 55A997E4.5080505@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/14/15 12:06 PM, Tom Lane wrote:
> Thom Brown <thom(at)linux(dot)com> writes:
>> On 14 July 2015 at 17:17, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> Since it's trivial to define this function if you need it, I'm not
>>> sure there's a reason to include it in core.
>
>> It's not always possible to create functions on a system when access
>> is restricted. It may even be the case that procedural languages are
>> prohibited, and plpgsql has been removed.
>
> By that argument, *any* random function has to be in the core.
>
> I really don't see what's wrong with "SELECT last_value FROM sequence",
> especially since that has worked in every Postgres version since 6.x.
> Anyone slightly worried about backwards compatibility wouldn't use
> an equivalent function even if we did add one.

Because you can't do that for all functions in a database.

FWIW, I think it'd be better to have a pg_sequences view that's the
equivalent of SELECT * FROM <sequence> for every sequence in the
database. That would let you get whatever info you needed.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2015-07-18 00:21:26 BRIN index and aborted transaction
Previous Message Jim Nasby 2015-07-17 23:36:55 Re: Support for N synchronous standby servers - take 2