Обсуждение: Commit not required for update statement

Поиск
Список
Период
Сортировка

Commit not required for update statement

От
prasanna rk
Дата:
Hi all

We are running posters 10.4 version, wanted to know if commit statement is not required for update.

Re: Commit not required for update statement

От
Evan Bauer
Дата:
Autocommit is, by default, off for embedded SQL programs in PostgreSQL 10.  The syntax to change that is:

SET AUTOCOMMIT TO ON

Cheers,

- Evan

Evan Bauer
eb@evanbauer.com
+1 646 641 2973
Skype: evanbauer


> On Oct 14, 2018, at 22:30, prasanna rk <prasanna2mail@gmail.com> wrote:
>
> Hi all
>
> We are running posters 10.4 version, wanted to know if commit statement is not required for update.



Re: Commit not required for update statement

От
Mark Kirkwood
Дата:
Hi,

Definitely worth reading what the docs say about this, should clear 
things up: 
https://www.postgresql.org/docs/current/static/tutorial-transactions.html

regards

Mark


On 15/10/18 15:30, prasanna rk wrote:
> Hi all
>
> We are running posters 10.4 version, wanted to know if commit 
> statement is not required for update.



Re: Commit not required for update statement

От
prasanna rk
Дата:
Hi Mark

Thank you for sharing, as per the link

"PostgreSQL actually treats every SQL statement as being executed within a transaction. If you do not issue a BEGINcommand, then each individual statement has an implicit BEGIN and (if successful) COMMIT wrapped around it. A group of statements surrounded by BEGIN and COMMIT is sometimes called a transaction block."

Note

Some client libraries issue BEGINand COMMIT commands automatically, so that you might get the effect of transaction blocks without asking. Check the documentation for the interface you are using.

Does this mean..every statement which does not have begin will be automatically commited. 


On Mon, 15 Oct 2018, 09:20 Mark Kirkwood, <mark.kirkwood@catalyst.net.nz> wrote:
Hi,

Definitely worth reading what the docs say about this, should clear
things up:
https://www.postgresql.org/docs/current/static/tutorial-transactions.html

regards

Mark


On 15/10/18 15:30, prasanna rk wrote:
> Hi all
>
> We are running posters 10.4 version, wanted to know if commit
> statement is not required for update.



Re: Commit not required for update statement

От
"David G. Johnston"
Дата:
On Sunday, October 14, 2018, prasanna rk <prasanna2mail@gmail.com> wrote:
Does this mean..every statement which does not have begin will be automatically commited. 

You should experiment in your chosen environment and see what does and doesn’t work.

David J.

Re: Commit not required for update statement

От
Mark Kirkwood
Дата:
Yeah - it matters whether you using psql client or python db api (for 
example) - as some of these decide to open a transaction immediately 
after a connection is established (via BEGIN) . So reading the docs and 
experimenting as indicated is essential!

regards

Mark


On 15/10/18 18:58, David G. Johnston wrote:
> On Sunday, October 14, 2018, prasanna rk <prasanna2mail@gmail.com 
> <mailto:prasanna2mail@gmail.com>> wrote:
>
>     Does this mean..every statement which does not have begin will be
>     automatically commited.
>
>
> You should experiment in your chosen environment and see what does and 
> doesn’t work.
>
> David J.
>