Skip to content

Commit 1666357

Browse files
author
Antonin Houska
committed
README: clarify the information on identity index.
1 parent 2ba30a6 commit 1666357

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,15 @@ CREATE TABLE measurement_y2006m03 PARTITION OF measurement_aux
101101
```
102102

103103
*It's essential that both the source (`measurement`) and target
104-
(`measurement_aux`) table have an identity index. The easiest way to ensure
105-
this is to create `PRIMARY KEY` or `UNIQUE` constraint. Also note that the key
106-
(i.e. column list) of the identity index of the source and target table must
107-
be identical. The identity is needed to process data changes that applications
108-
make while data is being copied from the source to the target table.*
104+
(`measurement_aux`) table have an identity index. It is needed to process data
105+
changes that applications make while data is being copied from the source to
106+
the target table. If the replica identity of the table is DEFAULT or FULL,
107+
primary key constraint provides the identity index. If your table has no
108+
primary key, you need to set the identity index explicitly using the [ALTER
109+
COMMAND ... REPLICA IDENTITY USING INDEX ...][1] command.
110+
111+
Also note that the key (i.e. column list) of the identity index of the source
112+
and target table must be identical.*
109113

110114
Then, in order to copy the data into the target table, run the
111115
`rewrite_table()` function and pass it both the source and target table, as
@@ -241,7 +245,8 @@ it needs.
241245
a table which is being rewritten.
242246

243247
2. The `rewrite_table()` function allows for MVCC-unsafe behavior described in
244-
the first paragraph of [mvcc-caveats][1].
248+
the first paragraph of [mvcc-caveats][2].
245249

246250

247-
[1]: https://www.postgresql.org/docs/current/mvcc-caveats.html
251+
[1] https://www.postgresql.org/docs/17/sql-altertable.html
252+
[2] https://www.postgresql.org/docs/current/mvcc-caveats.html

pg_rewrite.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,6 @@ rewrite_table_impl(char *relschema_src, char *relname_src,
898898
* (ERRCODE_TRIGGERED_ACTION_EXCEPTION might be worth consideration as
899899
* well.)
900900
*/
901-
/*
902-
* TODO Consider
903-
* https://github.com/cybertec-postgresql/pg_squeeze/issues/84 (also
904-
* update README).
905-
*/
906901
if (!OidIsValid(ident_idx_src))
907902
ereport(ERROR,
908903
(errcode(ERRCODE_UNIQUE_VIOLATION),

0 commit comments

Comments
 (0)