Re: Persistent changes in rolled-back transactions

Поиск
Список
Период
Сортировка
От Rui DeSousa
Тема Re: Persistent changes in rolled-back transactions
Дата
Msg-id 9B0F9F61-113F-419E-BC6B-12C9DE0D5BE9@crazybean.net
обсуждение исходный текст
Ответ на Re: Persistent changes in rolled-back transactions  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Persistent changes in rolled-back transactions  (Ron <ronljohnsonjr@gmail.com>)
Список pgsql-admin


On Nov 9, 2022, at 8:23 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:

Or just read the documentation for the current version (I seem to recall it used to be non-transactional, maybe...doesn't matter now).

In a lot of other databases DDL is not transactional and truncate is DDL — most likely confusing it with another RDBMS systems.

DDL is transactional in PostgreSQL thus you can even rollback table changes, etc. which is not possible in other RDBMS systems.

prod=# create table demo (a int);
CREATE TABLE
prod=# 
prod=# \d+ demo;
                                            Table "dev.demo"
 Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description 
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
 a      | integer |           |          |         | plain   |             |              | 
Access method: heap

prod=# begin;
BEGIN
prod=*# alter table demo add column b int;
ALTER TABLE
prod=*# \d+ demo;
                                            Table "dev.demo"
 Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description 
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
 a      | integer |           |          |         | plain   |             |              | 
 b      | integer |           |          |         | plain   |             |              | 
Access method: heap

prod=*# rollback;
ROLLBACK
prod=# \d+ demo;
                                            Table "dev.demo"
 Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description 
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
 a      | integer |           |          |         | plain   |             |              | 
Access method: heap

В списке pgsql-admin по дате отправления:

Предыдущее
От: Rui DeSousa
Дата:
Сообщение: Re: How to test replication without doing a failover
Следующее
От: Santanu Das
Дата:
Сообщение: PGAdmin 4 SSH tunnel asking for identity file password