pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: zhxpgh <zhxpgh@foxmail.com>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: two bugs
Date: Sat, 25 Feb 2023 09:43:22 +0800
Message-ID: <tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com> (raw)

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=#

view thread (2+ messages)  latest in thread

Message-ID: <tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com>
Permalink:  ../tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com/
Also on:    postgresql.org/message-id/tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: zhxpgh@foxmail.com
  Subject: Re: two bugs
  In-Reply-To: <tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com>
  References: <tencent_7294503D958856DB8D18599B2CF2C0AA4406@qq.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox