Обсуждение: creatng a new interface to postgresql, how do I update a field with a particular oid?

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

creatng a new interface to postgresql, how do I update a field with a particular oid?

От
Mark Nielsen
Дата:
Hello!

I think this might be a better place to post messages than the hackers
mailing list. I didn't catch this one the first time.

Anyways, I don't know if a web version currently exists, but I have gotten
a web interface to at least be able to view data from tables. Now I want
to update data.

If people are interested in what I am doing and would like to help out,
I am using ePerl, apache, and Javascript and you can e-mail me at
psql@tcu-inc.com

Anyways, my question is, I want to update specific rows according to their
oids. Oh, I am also using the perl module Pg. I can find out the oid of
the data retrieved, but I want to update data according to their oid.

Is there any easy way to do this using the moduel Pg or a select
statement? I couldn't find anything with the select statement and was
hoping Pg had something in it, but I couldn't find anything in it as well.

Thanks!

Mark

Re: [INTERFACES] creatng a new interface to postgresql, how do I update a field with a particular oid?

От
Hannu Krosing
Дата:
Mark Nielsen wrote:
>
> Hello!
>
>
> Anyways, my question is, I want to update specific rows according to their
> oids. Oh, I am also using the perl module Pg. I can find out the oid of
> the data retrieved, but I want to update data according to their oid.

update my_table
set
 field1 = value1,
 field2 = value2
where
 oid = my_oid
;

to make it faster you can create an index on the oid column.

It used to require a cast for pg to use the index, i.e.

where oid = const_oid::oid

but I don't know if it is still the case.

postgresql does not yet have a "select for update" syntax or
mechanics implemented.

----------
Hannu