Re: Adding a pg_get_owned_sequence function?

2024-01-09 Thread Tom Lane
=?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= writes: > Tom Lane writes: >> Maybe it would work to have both >> pg_get_serial_sequence(table text, column text) -> text >> pg_get_serial_sequence(table regclass, column text) -> regclass > I think it would be more correct to use name for the column

Re: Adding a pg_get_owned_sequence function?

2024-01-09 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > Peter Eisentraut writes: >> Would it work to change the signature of pg_get_serial_sequence to >> pg_get_serial_sequence(table anyelement, column text) -> anyelement >> and then check inside the function code whether text or regclass was passed? > > Probably not very

Re: Adding a pg_get_owned_sequence function?

2024-01-09 Thread Tom Lane
Peter Eisentraut writes: > Would it work to change the signature of pg_get_serial_sequence to > pg_get_serial_sequence(table anyelement, column text) -> anyelement > and then check inside the function code whether text or regclass was passed? Probably not very well, because then we'd get no

Re: Adding a pg_get_owned_sequence function?

2024-01-09 Thread Peter Eisentraut
On 08.01.24 22:08, Nathan Bossart wrote: I think these are reasonable concerns, but with this patch, we now have the following functions: pg_get_identity_sequence(table regclass, column name) -> regclass pg_get_serial_sequence(table text, column text) -> text If we only look at

Re: Adding a pg_get_owned_sequence function?

2024-01-08 Thread Nathan Bossart
On Mon, Jan 08, 2024 at 04:58:02PM +, Dagfinn Ilmari Mannsåker wrote: > We can't make pg_get_serial_sequence(text, text) not work on identity > columns any more, that would break existing users, and making the new > function not work on serial columns would make it harder for people to >

Re: Adding a pg_get_owned_sequence function?

2024-01-08 Thread Dagfinn Ilmari Mannsåker
vignesh C writes: > On Tue, 24 Oct 2023 at 22:00, Nathan Bossart wrote: >> >> On Tue, Sep 12, 2023 at 03:53:28PM +0100, Dagfinn Ilmari Mannsåker wrote: >> > Tom Lane writes: >> >> It's possible that we could get away with just summarily changing >> >> the argument type from text to regclass.

Re: Adding a pg_get_owned_sequence function?

2024-01-07 Thread vignesh C
On Tue, 24 Oct 2023 at 22:00, Nathan Bossart wrote: > > On Tue, Sep 12, 2023 at 03:53:28PM +0100, Dagfinn Ilmari Mannsåker wrote: > > Tom Lane writes: > >> It's possible that we could get away with just summarily changing > >> the argument type from text to regclass. ISTR that we did exactly >

Re: Adding a pg_get_owned_sequence function?

2023-12-08 Thread Shubham Khanna
On Fri, Dec 8, 2023 at 3:43 PM Dagfinn Ilmari Mannsåker wrote: > > Hi hackers, > > I've always been annoyed by the fact that pg_get_serial_sequence takes > the table and returns the sequence as strings rather than regclass. And > since identity columns were added, the name is misleading as well

Re: Adding a pg_get_owned_sequence function?

2023-10-24 Thread Nathan Bossart
On Tue, Sep 12, 2023 at 03:53:28PM +0100, Dagfinn Ilmari Mannsåker wrote: > Tom Lane writes: >> It's possible that we could get away with just summarily changing >> the argument type from text to regclass. ISTR that we did exactly >> that with nextval() years ago, and didn't get too much

Re: Adding a pg_get_owned_sequence function?

2023-09-12 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > Peter Eisentraut writes: >> Would it work to just overload pg_get_serial_sequence with regclass >> argument types? > > Probably not; the parser would have no principled way to resolve > pg_get_serial_sequence('foo', 'bar') as one or the other. I'm > not sure offhand if it

Re: Adding a pg_get_owned_sequence function?

2023-09-12 Thread Tom Lane
Peter Eisentraut writes: > Would it work to just overload pg_get_serial_sequence with regclass > argument types? Probably not; the parser would have no principled way to resolve pg_get_serial_sequence('foo', 'bar') as one or the other. I'm not sure offhand if it would throw error or just

Re: Adding a pg_get_owned_sequence function?

2023-09-12 Thread Peter Eisentraut
On 09.06.23 21:19, Dagfinn Ilmari Mannsåker wrote: I've always been annoyed by the fact that pg_get_serial_sequence takes the table and returns the sequence as strings rather than regclass. And since identity columns were added, the name is misleading as well (which is even acknowledged in the

Re: Adding a pg_get_owned_sequence function?

2023-09-08 Thread Nathan Bossart
On Fri, Sep 08, 2023 at 10:56:15AM -0400, Stephen Frost wrote: > If we're going to actually mark it deprecated then it should be, at > least, a yearly discussion about removing it. I'm generally more in > favor of either just keeping it, or just removing it, though. We've had > very little

Re: Adding a pg_get_owned_sequence function?

2023-09-08 Thread Stephen Frost
Greetings, * Nathan Bossart (nathandboss...@gmail.com) wrote: > On Fri, Sep 01, 2023 at 01:31:43PM -0400, Tom Lane wrote: > > Nathan Bossart writes: > >> I wonder if it'd be possible to just remove pg_get_serial_sequence(). > > > > A quick search at http://codesearch.debian.net/ finds uses of

Re: Adding a pg_get_owned_sequence function?

2023-09-01 Thread Nathan Bossart
On Fri, Sep 01, 2023 at 01:31:43PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> I wonder if it'd be possible to just remove pg_get_serial_sequence(). > > A quick search at http://codesearch.debian.net/ finds uses of it > in packages like gdal, qgis, rails, ... We could maybe get rid of >

Re: Adding a pg_get_owned_sequence function?

2023-09-01 Thread Tom Lane
Nathan Bossart writes: > I wonder if it'd be possible to just remove pg_get_serial_sequence(). A quick search at http://codesearch.debian.net/ finds uses of it in packages like gdal, qgis, rails, ... We could maybe get rid of it after a suitable deprecation period, but I think we can't just

Re: Adding a pg_get_owned_sequence function?

2023-09-01 Thread Nathan Bossart
On Fri, Jun 09, 2023 at 08:19:44PM +0100, Dagfinn Ilmari Mannsåker wrote: > I've always been annoyed by the fact that pg_get_serial_sequence takes > the table and returns the sequence as strings rather than regclass. And > since identity columns were added, the name is misleading as well (which >

Re: Adding a pg_get_owned_sequence function?

2023-08-31 Thread Dagfinn Ilmari Mannsåker
On Fri, 9 Jun 2023, at 20:19, Dagfinn Ilmari Mannsåker wrote: > Hi hackers, > > I've always been annoyed by the fact that pg_get_serial_sequence takes > the table and returns the sequence as strings rather than regclass. And > since identity columns were added, the name is misleading as well

Adding a pg_get_owned_sequence function?

2023-06-09 Thread Dagfinn Ilmari Mannsåker
Hi hackers, I've always been annoyed by the fact that pg_get_serial_sequence takes the table and returns the sequence as strings rather than regclass. And since identity columns were added, the name is misleading as well (which is even acknowledged in the docs, together with a suggestion for a