safely increase a single column integer value

Started by Anton Andreevover 18 years ago3 messagesgeneral
Jump to latest
#1Anton Andreev
fn30762@fmi.uni-sofia.bg

Hi,

What is the best way from concurrency point of view to increase a
integer value from a table?

Suppose you count every postback from all the users that are currently
browsing your web-site.

Cheers,
Anton

#2Samantha Atkins
sjatkins@mac.com
In reply to: Anton Andreev (#1)
for libpq which include defines the type oids

I am probably overlooking something but where exactly are these found
for inclusion is libpq based programs? Poking around my installation
doesn't make it obvious.

- samantha

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Samantha Atkins (#2)
Re: for libpq which include defines the type oids

On 06/11/2007, Samantha Atkins <sjatkins@mac.com> wrote:

I am probably overlooking something but where exactly are these found
for inclusion is libpq based programs? Poking around my installation
doesn't make it obvious.

- samantha

Get oids dynamically. Use static oids on client part isn't good idea.
They can by changed and than you have to recompile your application.,

postgres=# select 'integer'::regtype::int;
int4
------
23
(1 row)

Regards
Pavel Stehule