psql + autocommit [英] psql + autocommit

查看:73
本文介绍了psql + autocommit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着postgres v8的出现,是否可以将psql的

默认行为从AUTOCOMMIT = ON更改为AUTOCOMMIT = OFF?


虽然这可能会破坏向后兼容性,但可能是可以接受的,因为v8是一个主要的版本。


另外添加一个新的命令行参数控制AUTOCOMMIT

设置为那些将遇到破坏的脚本执行的用户

(特别是使用-c命令)可能有助于减轻痛苦,因为他们

只需要在现有脚本中添加新的开关,或者
在脚本中明确设置AUTOCOMMIT变量。否则他们

可以在脚本末尾添加最终的COMMIT。


在Oracle的SQLPlus中,AUTOCOMMIT = OFF是默认行为,是(在我的观点中,我认为是b $ b)比当前情况更好。


我知道AUTOCOMMIT可以在活动会话中设置,但我有时候

忘记导致无法回滚的数据丢失/损坏。使用

..psqlrc文件可能会导致不同帐户之间的不一致

其中一些人已经定义了设置而其他人没有。


这样做的最后一个原因是更接近SQL规范。


John Sidney-Woollett


--- ------------------------(播出结束)--------------------- ------

提示3:如果通过Usenet发布/阅读,请发送适当的

subscribe-nomail命令给 ma ******* @ postgresql.org 这样你的

消息可以干净地通过邮件列表

With the advent of postgres v8, would it be possible to change the
default behaviour of psql from AUTOCOMMIT=ON to AUTOCOMMIT=OFF ?

Although this might break backward compatibility, it might be acceptable
on the basis that v8 is such a major release.

Also adding a new command line parameter to control the AUTOCOMMIT
setting for those users that will experience broken scripts executed
(especially using the -c command) might help ease the pain, since they
would only have to add a new switch to their existing scripts, or
explictly set the AUTOCOMMIT variable in their scripts. Otherwise they
could add a final COMMIT at the end of the script.

In Oracle''s SQLPlus, AUTOCOMMIT=OFF is the default behaviour and is (in
my view) preferable to the current situation.

I know the AUTOCOMMIT can be set in an active session, but I sometimes
forget leading to an un-rollback-able data loss/damage. Using the
..psqlrc file can lead to inconsistancies between different accounts
where some have the setting defined and others don''t.

The final reason for doing so would be to closer to the SQL spec.

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

推荐答案

John Sidney-Woollett写道:
John Sidney-Woollett wrote:
随着postgres v8的问世,是否有可能改变从AUTOCOMMIT = ON到AUTOCOMMIT = OFF的psql默认行为?
With the advent of postgres v8, would it be possible to change the
default behaviour of psql from AUTOCOMMIT=ON to AUTOCOMMIT=OFF ?




绝对不行。这将破坏现有的每个psql使用。


-

Peter Eisentraut
http://developer.postgresql.org/~petere/

-------- -------------------(广播结束)-------------------------- -

提示1:订阅和取消订阅命令转到 ma ******* @ postgresql。组织



Absolutely not. This will break every psql use in existence.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


John Sidney-Woollett< jo **** @ wardbrook.com>写道:
John Sidney-Woollett <jo****@wardbrook.com> writes:
随着postgres v8的出现,是否可以将psql的默认行为从AUTOCOMMIT = ON更改为AUTOCOMMIT = OFF?
With the advent of postgres v8, would it be possible to change the
default behaviour of psql from AUTOCOMMIT=ON to AUTOCOMMIT=OFF ?




如果那就是你想要的,请在你的〜/ .psqlrc中设置。


问候,tom lane


---------------------------(广播结束)--------------- ------------

提示5:您查看了我们广泛的常见问题解答吗?

http://www.postgresql.org/docs/faqs/FAQ.html


不,它不会!


它将打破任何新编译的psql版本,希望能够工作到

旧的行为。它不会影响任何人使用旧版本的

postgres或psql(即8版之前版本)。


为了减轻任何痛苦,那么构建的配置设置

脚本用于postgres(和psql),它改变了

AUTOCOMMIT设置的默认行为。


我个人希望用AUTOCOMMIT = OFF来构建它。我有

设置这样做。


除了更符合标准之外,这种改变会有所帮助make

psql更安全比现在还要好。


John Sidney-Woollett


Peter Eisentraut写道:
No it won''t!

It will break any newly compiled version of psql expecting to work to
the old behaviour. It won''t affect anyone using an older version of
postgres or psql (ie pre version 8).

To ease any pain, what about a configuration setting for the build
script for postgres (and psql) which changes the default behaviour for
the AUTOCOMMIT setting.

I personally would want to build it with AUTOCOMMIT=OFF is I had the
setting to do so.

This change apart from being more standards compliant would help make
psql "safer" than it currently is.

John Sidney-Woollett

Peter Eisentraut wrote:
John Sidney-Woollett写道:
John Sidney-Woollett wrote:
随着postgres v8的出现,是否可以将psql的默认行为从AUTOCOMMIT = ON更改为AUTOCOMMIT = OFF?
With the advent of postgres v8, would it be possible to change the
default behaviour of psql from AUTOCOMMIT=ON to AUTOCOMMIT=OFF ?



绝对不是。这将破坏现有的每个psql使用。


Absolutely not. This will break every psql use in existence.




------------------------- - (广播结束)---------------------------

提示9:规划人员会忽略你的如果您的

加入列的数据类型不匹配,则希望选择索引扫描



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match


这篇关于psql + autocommit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆