Do not ignore schema of a table
When you are adding a new table, you can specify a schema. For example:
ALTER DISTRIBUTION ds1 ATTACH RELATION schema_name.table_name DISTRIBUTION KEY id;
In fact, during query/transaction routing, the schema is not taken into account. If there are tables with the same name but different schemas, they will be incorrectly routed. To fix this bug, you have to remember about search_path as well.
"RELATION any_id DISTRIBUTION KEY distribution_key_argument_list opt_auto_increment opt_schema_name ... opt_schema_name: SCHEMA any_id { $$ = $2 } | /* EMPTY */ { $$ = "" } " schema sets in schema clause. May be it's not bug, but a language feature. Does we need setup schema by 2 ways?
"ALTER DISTRIBUTION ds1 ATTACH RELATION schema_name.table_name DISTRIBUTION KEY id;" equals "ALTER DISTRIBUTION ds1 ATTACH RELATION table_name DISTRIBUTION KEY id SCHEMA schema_name;"
is it right?
Hi!
While both syntaxes are valid, the dot notation is more SQL-way, i think.
Deprecating the SCHEMA keyword version would simplify things and align with common practice. What do you think?
Fixed in https://github.com/pg-sharding/spqr/pull/1298. @xelavopelk thank you for your contribution!
No, #1298 was only the beginning of fixing problems.
https://github.com/pg-sharding/spqr/pull/1326
We paused https://github.com/pg-sharding/spqr/pull/1366 because the changes were becoming too dangerous for the existing installation. We had no intention of breaking backward compatibility.