-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: reduce (eliminate?) support for sessions without a current database set #23145
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-sql-pgcompatSemantic compatibility with PostgreSQLSemantic compatibility with PostgreSQLC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Description
Discussed with @nvanbenschoten and @jordanlewis while working on #21456 and #23045.
pg does not support client sessions without a current database set. The virtual schemas (especially pg_catalog) are not well-defined if there is no current database.
Also in their current implementation they can generate a large amount data if queried by a client without a current database set, putting pressure on the SQL allocation pool.
The discussion on #21456 suggests evolving CockroachDB so that client sessions more often find themselves with a current database set by default. There's a spectrum of approaches:
- have the current database set to
systemif not specified in the conn string / pgwire options - have the current database set to some arbitrary constant (e.g.
default) and encourage the user viacockroach sqlto create the database if it doesn't exist yet- might be a UX issue since only admin users can create databases
- have the current database set to the username (like in pg), encourage the user to create
- same UX problem as above
- make every new cluster contain a "default" database, set that as default current database for new sessions that don't specify otherwise
- same as above, but create the "default" db on-demand automatically
cc @bdarnell
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-pgcompatSemantic compatibility with PostgreSQLSemantic compatibility with PostgreSQLC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.