| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Manu <manuelreyesbravo(at)gmail(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19686: Rolling back SET TABLESPACE |
| Date: | 2026-10-03 04:26:03 |
| Message-ID: | CAGRkXqRNC2X1RR3Bt1gA3NwG5k0WQQSRxS71hVnCekFwPx_cYw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Manu,
v5 looks good. One small thing.
A sql_drop event trigger also runs after the ALTER, and v5 only
checks ddl_command_end. Andres said a superuser can keep the pieces
here, so maybe neither needs a check. But if you check one, the
other should be checked too.
CREATE TABLE t (a int, b int);
CREATE INDEX ON t (a);
CREATE FUNCTION f() RETURNS event_trigger LANGUAGE plpgsql AS $$
BEGIN
INSERT INTO t VALUES (5);
RAISE EXCEPTION 'fail';
END $$;
CREATE EVENT TRIGGER e ON sql_drop EXECUTE FUNCTION f();
ALTER TABLE t SET TABLESPACE ts, DROP COLUMN b;
DROP EVENT TRIGGER e;
INSERT INTO t VALUES (7);
SET enable_seqscan = off;
SELECT count(*) FROM t WHERE a = 5;
This returns 1 with v5, and 0 with the attached diff on top of v5.
Also, ALTER TABLE ALL IN TABLESPACE always copies the indexes. Is that on
purpose?
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-v5-sql-drop-check.diff.txt | text/plain | 580 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-03 04:33:52 | Re: [PATCH] Fix pg_dump emitting OVERRIDING SYSTEM VALUE for tables with dropped identity columns |
| Previous Message | Manu | 2026-10-03 03:08:26 | Re: doc: Document Linux cgroup memory limits |