Re: BUG #19686: Rolling back SET TABLESPACE - Mailing list pgsql-hackers

From shihao zhong
Subject Re: BUG #19686: Rolling back SET TABLESPACE
Date
Msg-id CAGRkXqRNC2X1RR3Bt1gA3NwG5k0WQQSRxS71hVnCekFwPx_cYw@mail.gmail.com
Whole thread
In response to Re: BUG #19686: Rolling back SET TABLESPACE  (Manu <manuelreyesbravo@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Manu
Date:
Subject: Re: doc: Document Linux cgroup memory limits
Next
From: shihao zhong
Date:
Subject: Re: [PATCH] Fix pg_dump emitting OVERRIDING SYSTEM VALUE for tables with dropped identity columns