-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: crdb_internal.ranges{,no_leases} does not interoperate correctly with user-defined schemas #59601
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Description
There is no disambiguating schema_name column in these tables, but there should be. The consequence of the lack of this is as follows:
demo@127.0.0.1:26257/defaultdb> create schema s;
CREATE SCHEMA
Time: 23ms total (execution 8ms / network 14ms)
demo@127.0.0.1:26257/defaultdb> create table t1 (a) as select 1;
CREATE TABLE AS
Time: 35ms total (execution 4ms / network 31ms)
demo@127.0.0.1:26257/defaultdb> create table s.t1 (a) as select 1;
CREATE TABLE AS
Time: 27ms total (execution 3ms / network 24ms)
demo@127.0.0.1:26257/defaultdb>
demo@127.0.0.1:26257/defaultdb>
demo@127.0.0.1:26257/defaultdb>
demo@127.0.0.1:26257/defaultdb> select * from crdb_Internal.ranges_no_leases where table_name='t1' and database_name='defaultdb';
range_id | start_key | start_pretty | end_key | end_pretty | database_name | table_name | index_name | replicas | replica_localities | learner_replicas | split_enforced_until
-----------+-----------+--------------+----------+------------+---------------+------------+------------+----------+--------------------------+------------------+-----------------------
38 | \277 | /Table/55 | \300 | /Table/56 | defaultdb | t1 | | {1} | {"region=us-east1,az=b"} | {} | NULL
39 | \300 | /Table/56 | \377\377 | /Max | defaultdb | t1 | | {1} | {"region=us-east1,az=b"} | {} | NULL
(2 rows)
In addition, I feel like this table should also contain a table id - it'll just make things easier to join against other tables.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.