From: | Marc Boeren <m(dot)boeren(at)guidance(dot)nl> |
---|---|
To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16758: create temporary table with the same name loses defaults, indexes |
Date: | 2020-12-01 14:18:12 |
Message-ID: | 831E420C-D9D5-4563-ABA4-F05F03E6D7DE@guidance.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
As a followup, if I change the name to something different from the original, like 'xy', it works as expected.
> On 1 Dec 2020, at 15:09, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 16758
> Logged by: Marc Boeren
> Email address: marc(at)guidance(dot)nl
> PostgreSQL version: 12.5
> Operating system: macOS / docker-debian / CentOR
> Description:
>
> In 12.5 (and later), in a clean, empty database (in this case the default
> 12.5 docker image), when I execute the following lines:
>
> create table xx (name text NOT NULL default '', PRIMARY KEY(name));
>
> create temporary table xx
> (like xx including DEFAULTS including CONSTRAINTS including
> INDEXES);
>
> select c.relname, n.nspname
> from pg_namespace n
> join pg_class c on n.oid=c.relnamespace
> where (c.relname LIKE 'x%') order by n.nspname, c.relname;
>
> I get this:
>
> relname nspname
> "xx" "pg_temp_8"
> "xx" "public"
> "xx_pkey" "public"
>
> I expected the primary key to be copied too. Comparing the results from 12.4
> (and earlier versions):
>
> relname nspname
> "xx" "pg_temp_8"
> "xx_pkey" "pg_temp_8"
> "xx" "public"
> "xx_pkey" "public"
>
> I couldn't find anything in the changelog for 12.5 that indicates it is
> intentional. I checked against 13.1 too, same problem.
> The actual table is a bit larger (about 100 fields, no relations) and loses
> the primary key and all indexes and defaults since 12.5. The SQL above is
> the shortest form that demonstrates the issue.
>
> Thanks, Marc
>
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2020-12-01 14:27:12 | Re: [External] Re: pgadmin--pgagent---the process hang by unknow reasons |
Previous Message | PG Bug reporting form | 2020-12-01 14:09:49 | BUG #16758: create temporary table with the same name loses defaults, indexes |