pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix DROP DATABASE for databases with many ACLs
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:27  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f92b230f88b98c34b9804c4b4226e0d1822dc53

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d1da80115004af2a2093479556b45d2fbcfcd571

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/545794515c8718e4b8b81768644b5f8abe01da80

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/df9c5fb5837fed76e2c80daa03a2b0443983614b

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b3bb1e24b62c664dae694bfae6b409ac2b0aad3d

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/33c615f764c32abf20bf8a5a71fcb44115551867

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix DROP DATABASE for databases with many ACLs
@ 2024-08-18 22:28  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2024-08-18 22:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix DROP DATABASE for databases with many ACLs

Commit c66a7d75e652 modified DROP DATABASE so that if interrupted, the
database is known to be in an invalid state and can only be dropped.
This is done by setting a flag using an in-place update, so that it's
not lost in case of rollback.

For databases with many ACLs, this may however fail like this:

  ERROR:  wrong tuple length

This happens because with many ACLs, the pg_database.datacl attribute
gets TOASTed. The dropdb() code reads the tuple from the syscache, which
means it's detoasted. But the in-place update expects the tuple length
to match the on-disk tuple.

Fixed by reading the tuple from the catalog directly, not from syscache.

Report and fix by Ayush Tiwari. Backpatch to 12. The DROP DATABASE fix
was backpatched to 11, but 11 is EOL at this point.

Reported-by: Ayush Tiwari
Author: Ayush Tiwari
Reviewed-by: Tomas Vondra
Backpatch-through: 12
Discussion: https://postgr.es/m/CAJTYsWWNkCt+-UnMhg=BiCD3Mh8c2JdHLofPxsW3m2dkDFw8RA@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f18d3e47f0fe2743ea9d93b10fedd504ba818f4a

Modified Files
--------------
src/backend/commands/dbcommands.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2024-08-18 22:28 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-18 22:27 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>
2024-08-18 22:28 pgsql: Fix DROP DATABASE for databases with many ACLs Tomas Vondra <tomas.vondra@postgresql.org>

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