Hi,
what's the best way to insert a new invoice to the following table
create table invoice_table (
id serial;
number int;
year int;
)
The problem is of course that 'number' is unique only in the given year
so I'd need to lock table and do something like
insert into invoice_table (number,year) values (max(...)+1,2000)
I guess this is fairly common problem, what's the best/standard PG way
of
doing it? Thanks for your help.
- Robert