two bugs - Mailing list pgsql-bugs

From zhxpgh
Subject two bugs
Date
Msg-id tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com
Whole thread Raw
Responses Re: two bugs  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
List pgsql-bugs

The first:

zhxp@THINKPAD-E14:~/repositories/postgres/postgres$ psql
psql (12.14)
Type "help" for help.

postgres=# create table trigtest(i serial primary key);
CREATE TABLE
postgres=# create table trigtestfk(i int references trigtest(i) on delete cascade);
CREATE TABLE
postgres=# insert into trigtest default values;
INSERT 0 1
postgres=# insert into trigtest default values;
INSERT 0 1
postgres=# insert into trigtest default values;
INSERT 0 1
postgres=# select * from trigtest;
 i
---
 1
 2
 3
(3 rows)

postgres=# insert into trigtestfk values (1);
INSERT 0 1
postgres=# alter table trigtest disable trigger all;
ALTER TABLE
postgres=# delete from trigtest where i = 1;
DELETE 1
postgres=# select * from trigtest;
 i
---
 2
 3
(2 rows)

postgres=# select * from trigtestfk;
 i
---
 1
(1 row)

postgres=# \q
zhxp@THINKPAD-E14:~/release/pg$ bin/pg_dump > trigtets.sql
zhxp@THINKPAD-E14:~/release/pg$ bin/createdb trigtest
zhxp@THINKPAD-E14:~/release/pg$ psql trigtest
psql (12.14)
Type "help" for help.

trigtest=# \i /home/zhxp/release/pg/trigtets.sql
SET
SET
SET
SET
SET
 set_config
------------

(1 row)

SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
ALTER SEQUENCE
CREATE TABLE
ALTER TABLE
ALTER TABLE
COPY 2
COPY 1
 setval
--------
      4
(1 row)

ALTER TABLE
psql:/home/zhxp/release/pg/trigtets.sql:113: ERROR:  insert or update on table "trigtestfk" violates foreign key constraint "trigtestfk_i_fkey"
DETAIL:  Key (i)=(1) is not present in table "trigtest".
trigtest=#

and the second:
zhxp@THINKPAD-E14:~/release/pg$ psql
psql (12.14)
Type "help" for help.

postgres=# create table t1(i int);
CREATE TABLE
postgres=# insert into t1 values (1);
INSERT 0 1
postgres=# create materialized view mv_t1 as select * from t1;
SELECT 1
postgres=# create unique index on mv_t1(i);
CREATE INDEX
postgres=# insert into t1 values (1);
INSERT 0 1
postgres=# select * from t1;
 i
---
 1
 1
(2 rows)

postgres=# select * from mv_t1;
 i
---
 1
(1 row)

postgres=# \q
zhxp@THINKPAD-E14:~/release/pg$ bin/pg_dump > mvtest.sql
zhxp@THINKPAD-E14:~/release/pg$ bin/createdb mvtest
zhxp@THINKPAD-E14:~/release/pg$ psql mvtest
psql (12.14)
Type "help" for help.

mvtest=# \i /home/zhxp/release/pg/mvtest.sql
SET
SET
SET
SET
SET
 set_config
------------

(1 row)

SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
CREATE MATERIALIZED VIEW
ALTER TABLE
COPY 2
CREATE INDEX
psql:/home/zhxp/release/pg/mvtest.sql:67: ERROR:  could not create unique index "mv_t1_i_idx"
DETAIL:  Key (i)=(1) is duplicated.
mvtest=#

pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash
Next
From: Michael Paquier
Date:
Subject: Re: BUG #17744: Fail Assert while recoverying from pg_basebackup