From: | "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | "Harpreet Dhaliwal" <harpreet(dot)dhaliwal01(at)gmail(dot)com> |
Subject: | Re: SQL Transaction related |
Date: | 2007-05-10 06:49:02 |
Message-ID: | 200705092349.02345.uwe@oss4u.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Yes it will. Everything INSIDE ONE transaction is visible to that exact
transaction. So in your scenario the val1 from the select will see what was
inserted - just any other transaction won't unless the current one is
committed.
Uwe
On Wednesday 09 May 2007, Harpreet Dhaliwal wrote:
> Hi,
>
> I have a transaction like following:
>
> BEGIN
>
> INSERT INTO tbl_xyz VALUES (val1, val2);
>
> SELECT INTO wid MAX(val1) FROM tbl_xyz;
>
> END;
>
> My question is in the SELECT INTO statement, will I get the value of val1
> from the INSERT INTO in the same transaction
> even though the transaction has not ended yet.
> I think no.
> How would I get that latest value of val1 in the same transaction because
> its not committed yet as the transaction has not ended.
>
> Thanks,
>
> ~Harpreeet
--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2007-05-10 06:55:52 | Re: SQL Transaction related |
Previous Message | Harpreet Dhaliwal | 2007-05-10 06:24:40 | SQL Transaction related |