Support DDL commands that have different schema qualified names within them
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
We recently notably improved our schema support. An open issue relates to certain DDL commands that have multiple schema qualified names within them. For example, if the user runs an `ALTER TABLE` that has a table name qualified as `foo.table_name` and a type named qualified as `bar.type_name`, then we have an incorrect behavior.
At a higher level, we have two types of queries as it relates to passing down schema names:
1. Queries we can deparse: For these queries, we handle all schema names.
2. Queries we can't deparse (`ALTER TABLE` and `CREATE INDEX`): We currently can't have different references to schema qualified names. For example, if a query has a schema qualified table name and a schema qualified type, this doesn't work.
@anarazel noted that a simple fix could be to consistently pass down the `search_path` and leave the DDL command as-is could work.
I'm cool with either approach, deparsing all commands or passing down the `search_path`. I think what matters most is that we're **consistent** in how we handle schema names.
@byucesoy has this note about our current behavior: "We also support create/drop index queries with schemas. Currently we only don't support `ALTER TABLE` and `GRANT` statements.
I think Andres' suggestion regarding setting `search_path` in the workers makes sense. This approach would make it possible to support other DDL commands we will add in the future automatically. I am just wondering if connection cash may cause any problems. I vaguely remember some discussion about using previously opened connections. I don't have detailed knowledge about that part of the Citus yet."
Contributor guide
Research direction
Review the current handling of schema-qualified names in ALTER TABLE, CREATE INDEX, and GRANT, including the paths that deparse queries and the worker search_path approach mentioned in the discussion. Check how previously opened connections and workers receive schema context. Done means DDL commands consistently resolve multiple schema-qualified names across these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100