postgresql事务的操作
\l 列出数据库
\c testdb 切换数据库
SELECT tablename FROM pg_tables
WHERE tablename NOT LIKE 'pg%'
AND tablename NOT LIKE 'sql_%'
ORDER BY tablename; 查看所有的表列表
\d table 查看表结构
--
testdb=# begin;
BEGIN
testdb=# commit;
COMMIT
开始事务 提交事务
testdb=# abort;
NOTICE: there is no transaction in progress
ROLLBACK
abort
--
testdb=# \help abort
命令: ABORT
描述: 中止目前的交易
语法:
ABORT [ WORK | TRANSACTION ]
--
testdb=# begin;
BEGIN
testdb=# abort; 中止交易,回滚操作
ROLLBACK
testdb=# commit;
WARNING: there is no transaction in progress ,回滚就没有事务了
COMMIT
--------------------