SQL statement to set next serial value to max of a table? - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject SQL statement to set next serial value to max of a table?
Date
Msg-id 3D51A6E5.3090207@mega-bucks.co.jp
Whole thread Raw
List pgsql-general
I want to execute the following two pseudo-SQL statements (that set the
current value in a serial as the max of the primary key) as one SQL
statement. What is the proper syntax?

1- MAX = select max(id) from T;
2- SELECT setval('T_id_seq', MAX);

Jc


pgsql-general by date:

Previous
From: Gregory Seidman
Date:
Subject: Re: transactions, serial ids, and JDBC
Next
From: "Glen Parker"
Date:
Subject: Create index ... On ... (lower(field1), lower(field2)) doesn't work?