On 22/04/2019 18:49, Tom Lane wrote:
"Ray O'Donnell" writes:
In general, then, is it not possible to use an expression thus? -
[...] ALTER COLUMN [...] RESTART WITH
No. In general, PG's utility commands (everything except SELECT/
INSERT/UPDATE/DELETE) don't do expression evaluation
Ray O'Donnell schrieb am 22.04.2019 um 17:30:
I'm probably doing something silly I'm migrating data from one
database table to another, where the old table used a SERIAL primary
key and the new one uses GENERATED BY DEFAULT AS IDENTITY. Having
loaded the data into the new table, I need to res
On 4/22/19 10:08 AM, Ray O'Donnell wrote:
On 22/04/2019 17:02, Adrian Klaver wrote:
do language plpgsql $$
declare m_max_id bigint;
begin
select max(id) + 1 from identity_test into m_max_id;
EXECUTE 'alter table identity_test alter column id restart with ' ||
m_max_id;
end;
$$;
Thanks a mil
"Ray O'Donnell" writes:
> In general, then, is it not possible to use an expression thus? -
> [...] ALTER COLUMN [...] RESTART WITH
No. In general, PG's utility commands (everything except SELECT/
INSERT/UPDATE/DELETE) don't do expression evaluation. Partly this
is laziness or lack of ro
On 22/04/2019 17:02, Adrian Klaver wrote:
do language plpgsql $$
declare m_max_id bigint;
begin
select max(id) + 1 from identity_test into m_max_id;
EXECUTE 'alter table identity_test alter column id restart with ' ||
m_max_id;
end;
$$;
Thanks a million Adrian - EXECUTE did the job, and I fi
On 4/22/19 8:30 AM, Ray O'Donnell wrote:
Hi all,
I'm probably doing something silly I'm migrating data from one
database table to another, where the old table used a SERIAL primary key
and the new one uses GENERATED BY DEFAULT AS IDENTITY. Having loaded the
data into the new table, I need
On 4/22/19 8:45 AM, Adrian Klaver wrote:
On 4/22/19 8:30 AM, Ray O'Donnell wrote:
Hi all,
I'm probably doing something silly I'm migrating data from one
database table to another, where the old table used a SERIAL primary
key and the new one uses GENERATED BY DEFAULT AS IDENTITY. Having
On 4/22/19 8:30 AM, Ray O'Donnell wrote:
Hi all,
I'm probably doing something silly I'm migrating data from one
database table to another, where the old table used a SERIAL primary key
and the new one uses GENERATED BY DEFAULT AS IDENTITY. Having loaded the
data into the new table, I need
Hi all,
I'm probably doing something silly I'm migrating data from one
database table to another, where the old table used a SERIAL primary key
and the new one uses GENERATED BY DEFAULT AS IDENTITY. Having loaded the
data into the new table, I need to reset the underlying sequence so that