pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
For update
7+ messages / 3 participants
[nested] [flat]

* For update
@ 2006-01-16 16:59 Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 7+ messages in thread

From: Ottó Havasvölgyi @ 2006-01-16 16:59 UTC (permalink / raw)
  To: pgsql-sql

Hello,

What does this do exactly:

select * from <ViewName> where <condition>  for update;

Will be locked all the tuples in all tables it retrieves?

In 8.0.5 this did not work for me.

Thanks,
Otto

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
@ 2006-01-16 17:05 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 17:29   ` Re: For update Michael Fuhr <mike@fuhr.org>
  2006-01-16 21:33   ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Alvaro Herrera @ 2006-01-16 17:05 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; +Cc: pgsql-sql

Ottó Havasvölgyi wrote:

> What does this do exactly:
> 
> select * from <ViewName> where <condition>  for update;
> 
> Will be locked all the tuples in all tables it retrieves?

Yes.

> In 8.0.5 this did not work for me.

How did it not work?  Was any error message emitted?  What is the view
definition?

-- 
Alvaro Herrera                           Developer, http://www.PostgreSQL.org
"MySQL is a toy compared to PostgreSQL."             (Randal L. Schwartz)
      (http://archives.postgresql.org/pgsql-general/2005-07/msg00517.php)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2006-01-16 17:29   ` Michael Fuhr <mike@fuhr.org>
  1 sibling, 0 replies; 7+ messages in thread

From: Michael Fuhr @ 2006-01-16 17:29 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; pgsql-sql

On Mon, Jan 16, 2006 at 02:05:15PM -0300, Alvaro Herrera wrote:
> Ottó Havasvölgyi wrote:
> > What does this do exactly:
> > 
> > select * from <ViewName> where <condition>  for update;
> > 
> > Will be locked all the tuples in all tables it retrieves?
> 
> Yes.
> 
> > In 8.0.5 this did not work for me.
> 
> How did it not work?  Was any error message emitted?  What is the view
> definition?

I wonder if "not work" means "didn't lock the rows" and the cause
is simply not having a surrounding transaction.

-- 
Michael Fuhr



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2006-01-16 21:33   ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 21:37     ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  1 sibling, 1 reply; 7+ messages in thread

From: Ottó Havasvölgyi @ 2006-01-16 21:33 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; pgsql-sql

Hello,

Huh, it was weeks ago, and I thought it was normal. It was a simple view
with one or two inner joins and without aggragates. Perhaps somebody could
try it. I got an error message, that said I cannot do that. I cannot
remember the exact message unfortunately.

Best Regards,
Otto



2006/1/16, Alvaro Herrera <alvherre@alvh.no-ip.org>:
>
> Ottó Havasvölgyi wrote:
>
> > What does this do exactly:
> >
> > select * from <ViewName> where <condition>  for update;
> >
> > Will be locked all the tuples in all tables it retrieves?
>
> Yes.
>
> > In 8.0.5 this did not work for me.
>
> How did it not work?  Was any error message emitted?  What is the view
> definition?
>
> --
> Alvaro Herrera                           Developer,
> http://www.PostgreSQL.org <http://www.postgresql.org/;
> "MySQL is a toy compared to PostgreSQL."             (Randal L. Schwartz)
>      (http://archives.postgresql.org/pgsql-general/2005-07/msg00517.php)
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 21:33   ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
@ 2006-01-16 21:37     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 22:15       ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Alvaro Herrera @ 2006-01-16 21:37 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; +Cc: pgsql-sql

Ottó Havasvölgyi wrote:
> Hello,
> 
> Huh, it was weeks ago, and I thought it was normal. It was a simple view
> with one or two inner joins and without aggragates. Perhaps somebody could
> try it. I got an error message, that said I cannot do that. I cannot
> remember the exact message unfortunately.

Sure, I can try it.  Show us the definition and tell us what version are
you using.

-- 
Alvaro Herrera                                http://www.PlanetPostgreSQL.org
"People get annoyed when you try to debug them."  (Larry Wall)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 21:33   ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 21:37     ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2006-01-16 22:15       ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 23:51         ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Ottó Havasvölgyi @ 2006-01-16 22:15 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; pgsql-sql

Hello,

Sorry, I have just tried it, and works with 8.0.5. I had missed something
then. :(
I like PostgreSQL. :)

Thanks,
Otto


2006/1/16, Alvaro Herrera <alvherre@alvh.no-ip.org>:
>
> Ottó Havasvölgyi wrote:
> > Hello,
> >
> > Huh, it was weeks ago, and I thought it was normal. It was a simple view
> > with one or two inner joins and without aggragates. Perhaps somebody
> could
> > try it. I got an error message, that said I cannot do that. I cannot
> > remember the exact message unfortunately.
>
> Sure, I can try it.  Show us the definition and tell us what version are
> you using.
>
> --
> Alvaro Herrera
> http://www.PlanetPostgreSQL.org
> "People get annoyed when you try to debug them."  (Larry Wall)
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: For update
  2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 17:05 ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 21:33   ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  2006-01-16 21:37     ` Re: For update Alvaro Herrera <alvherre@alvh.no-ip.org>
  2006-01-16 22:15       ` Re: For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
@ 2006-01-16 23:51         ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Ottó Havasvölgyi @ 2006-01-16 23:51 UTC (permalink / raw)
  To: Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>; pgsql-sql

Hello,

Oh, I got it. Now in 8.0.6

When the view has UNION ALL, then PostgreSQL reports this: SELECT FOR UPDATE
is not allowed in subqueries .

I see why:

select * from <view> for update;

After extraction:

select * from <subquery1> UNION ALL <subquery2> for update;

In this case it seems as if "for update" is in subquery2.

How can this be tricked?

Thanks,
Otto


2006/1/16, Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>:
>
> Hello,
>
> Sorry, I have just tried it, and works with 8.0.5. I had missed something
> then. :(
> I like PostgreSQL. :)
>
> Thanks,
> Otto
>
>
> 2006/1/16, Alvaro Herrera <alvherre@alvh.no-ip.org>:
> >
> > Ottó Havasvölgyi wrote:
> > > Hello,
> > >
> > > Huh, it was weeks ago, and I thought it was normal. It was a simple
> > view
> > > with one or two inner joins and without aggragates. Perhaps somebody
> > could
> > > try it. I got an error message, that said I cannot do that. I cannot
> > > remember the exact message unfortunately.
> >
> > Sure, I can try it.  Show us the definition and tell us what version are
> >
> > you using.
> >
> > --
> > Alvaro Herrera
> > http://www.PlanetPostgreSQL.org <http://www.planetpostgresql.org/;
> > "People get annoyed when you try to debug them."  (Larry Wall)
> >
>
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2006-01-16 23:51 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-16 16:59 For update Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
2006-01-16 17:05 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2006-01-16 17:29   ` Michael Fuhr <mike@fuhr.org>
2006-01-16 21:33   ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
2006-01-16 21:37     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2006-01-16 22:15       ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>
2006-01-16 23:51         ` Ottó Havasvölgyi <havasvolgyi.otto@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox