Re: identity not working with inherited table

From: José Luis Viejo <jlviejo(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: identity not working with inherited table
Date: 2019-05-05 10:49:48
Message-ID: CAB1Cj4Nf3iMfXWvFSn7voq1h9udGKwrn7urC2B0=zGUMiPbAYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Michael

I'm using PostgreSQL 11 latest version, having problems with an identity as
PK that inherits a table.

assume you have simple parent table like:

CREATE TABLE test7
(
id_t7 int GENERATED always AS IDENTITY PRIMARY KEY,
folio int GENERATED always AS IDENTITY,
client int
);

with any inherited table like:

CREATE TABLE test7_detail1(
-- uuid uuid DEFAULT uuid_generate_v4(), <-- fiddle doesn't support it
in_process boolean,
id_corte integer,
ts_captura timestamp(6) without time zone DEFAULT
(now())::timestamp without time zone) INHERITS (test7);

if I try insert like:

insert into test7_detail1 (client,in_process, id_corte)values (20797,'t',101)

it returns:

ERROR: null value in column "id_t7" violates not-null constraint
DETAIL: Failing row contains (null, null, 20797, t, 101, 2019-05-03
22:27:54.823894).

here <https://www.db-fiddle.com/f/iYkASiKbr8t1oEg1U2MCcX/2> is the fiddle

thanks in advance, best regards

jose

On Sun, May 5, 2019 at 4:31 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Sat, May 04, 2019 at 12:11:51AM -0500, José Luis Viejo wrote:
> > I hope this helps to clarify the problem
> >
> >
> https://stackoverflow.com/questions/55979456/identity-not-working-with-inherited-table
>
> If Stack overflow goes away, then we would lost this information when
> referring to the archives of PostgreSQL mailing lists, and not
> everybody is willing to follow the information on the link. Could you
> send directly to this thread what you think the actual problem is,
> what you are noticing, and what you would expect? Using SQL queries
> is of course recommended.
> --
> Michael
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2019-05-05 11:15:57 Re: identity not working with inherited table
Previous Message Michael Paquier 2019-05-05 09:31:12 Re: identity not working with inherited table