On 8 February 2014 23:08, Andres Freund <and...@2ndquadrant.com> wrote: > On 2014-02-08 22:58:35 +0000, Thom Brown wrote: >> Another question: in order for logical decoding/replication to be >> useful, presumably one would need a primary key on every table? It's >> just I haven't seen this mentioned on the changeset extraction page in >> the docs. > > Hm, that's a good point. 07cacba983ef79be4a84fcd0e0ca3b5fcb85dd65 added > configurability for that, but there at least should be a link to > http://www.postgresql.org/docs/devel/static/sql-altertable.html with > some additional words.
# CREATE TABLE test (id serial primary key, val int); CREATE TABLE # INSERT INTO test (val) SELECT generate_series(1,3); INSERT 0 3 # ALTER TABLE test ADD COLUMN a decimal DEFAULT 2.22; ALTER TABLE # ALTER TABLE test ADD COLUMN b json DEFAULT '{"a":[1,2,3],"b":[4,5,6]}'; ALTER TABLE The output generated by those last 2 statements is: BEGIN 891 table "pg_temp_16552": INSERT: id[int4]:1 val[int4]:1 a[numeric]:2.22 table "pg_temp_16552": INSERT: id[int4]:2 val[int4]:2 a[numeric]:2.22 table "pg_temp_16552": INSERT: id[int4]:3 val[int4]:3 a[numeric]:2.22 COMMIT 891 BEGIN 892 table "pg_temp_16552": INSERT: id[int4]:1 val[int4]:1 a[numeric]:2.22 b[json]:{"a":[1,2,3],"b":[4,5,6]} table "pg_temp_16552": INSERT: id[int4]:2 val[int4]:2 a[numeric]:2.22 b[json]:{"a":[1,2,3],"b":[4,5,6]} table "pg_temp_16552": INSERT: id[int4]:3 val[int4]:3 a[numeric]:2.22 b[json]:{"a":[1,2,3],"b":[4,5,6]} COMMIT 892 This is showing inserts into the temp table as part of the operation. Is that sufficient? -- Thom -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers