Re: checking existence of a table before updating its SERIAL

2020-06-08 Thread Thomas Kellerer
Matthias Apitz schrieb am 08.06.2020 um 09:53: > We're updating the SERIAL of a bunch of tables with a SQL script which > does for any table: > > /* table: idm_tasktab */ > DO $$ > DECLARE > max_id int; > BEGIN > SELECT INTO max_id GREATEST(COALESCE(max(taskid), 0),0) + 1 FROM > idm_tasktab; >

Re: checking existence of a table before updating its SERIAL

2020-06-08 Thread David G. Johnston
On Monday, June 8, 2020, Matthias Apitz wrote: > > Can some kind soul help me with doing a test for the existence of the > table to avoid the error message about non existing relation? > https://www.postgresql.org/docs/12/catalogs-overview.html David J.