Re: Adding a pg_get_owned_sequence function?

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Adding a pg_get_owned_sequence function?
Date: 2024-01-09 16:41:14
Message-ID: bc0ddf01-d54f-4a9b-9cf9-a3bf02731fde@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 the names, it sure sounds like the first one only works
> for identity columns, and the second only works for serial columns. But
> both work for identity_and_ serial. The real differences between the two
> are the parameter and return types. Granted, this is described in the
> documentation updates, but IMHO this is a kind-of bizarre state to end up
> in.

Yeah, that's really weird.

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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-01-09 16:44:32 Re: Fix bogus Asserts in calc_non_nestloop_required_outer
Previous Message Tom Lane 2024-01-09 16:38:10 Re: pg_dump: Remove obsolete trigger support