agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Sebastien FLAESCH <sf@4js.com>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Serial sequence name when table/column name in uppercase
Date: Wed, 31 Mar 2021 12:13:30 +0200
Message-ID: <87d8f930-a87c-2d08-f362-d59655ca6c24@4js.com> (raw)
In-Reply-To: <CAB8KJ=hnuX0aKLj490Q2ryX0aFRg-z-aur=JtiW=7r4-prT+mQ@mail.gmail.com>
References: <cc5742f1-7b3f-5051-e033-e99ff69245e7@4js.com>
<CAB8KJ=hnuX0aKLj490Q2ryX0aFRg-z-aur=JtiW=7r4-prT+mQ@mail.gmail.com>
On 3/31/21 10:51 AM, Ian Lawrence Barwick wrote:
> 2021年3月31日(水) 17:35 Sebastien FLAESCH <sf@4js.com>:
>>
>> Hello,
>>
>> How do I get the sequence name for a serial/bigserial column, of a table
>> and/or column name is created with uppercase letters?
>>
>> test1=> create table "TAB13" ( "PKEY" BIGSERIAL, "NAME" VARCHAR(50) );
>> CREATE TABLE
>>
>> test1=> select pg_get_serial_sequence(current_schema||'.tab13','pkey');
>> ERROR: relation "public.tab13" does not exist
>>
>> test1=> select pg_get_serial_sequence(current_schema||'.TAB13','PKEY');
>> ERROR: relation "public.tab13" does not exist
>
> Somewhat counterintuitively:
>
> postgres=# SELECT pg_get_serial_sequence('"TAB13"','PKEY');
> pg_get_serial_sequence
> -------------------------
> public."TAB13_PKEY_seq"
> (1 row)
>
> Regards
>
> Ian Barwick
>
> --
> EnterpriseDB: https://www.enterprisedb.com
>
>
Ok thanks a lot I got it now, must specify double-quotes around table name.
test1=> select pg_get_serial_sequence(current_schema||'."TAB13"','PKEY');
pg_get_serial_sequence
-------------------------
public."TAB13_PKEY_seq"
Seb
view thread (7+ messages) latest in thread
Message-ID: <87d8f930-a87c-2d08-f362-d59655ca6c24@4js.com>
Permalink: ../87d8f930-a87c-2d08-f362-d59655ca6c24@4js.com/
Also on: postgresql.org/message-id/87d8f930-a87c-2d08-f362-d59655ca6c24@4js.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sf@4js.com, pgsql-sql@lists.postgresql.org
Subject: Re: Serial sequence name when table/column name in uppercase
In-Reply-To: <87d8f930-a87c-2d08-f362-d59655ca6c24@4js.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox