pepijnve commented on code in PR #25112:
URL: https://github.com/apache/datafusion/pull/25112#discussion_r4082237936


##########
docs/source/user-guide/sql/ddl.md:
##########
@@ -35,6 +35,58 @@ CREATE DATABASE [ IF NOT EXISTS ] <i><b>catalog</i></b>
 CREATE DATABASE cat;
 ```
 
+## CREATE EXTERNAL CATALOG

Review Comment:
   A quick Claude generated survey that may or may not be useful:
   
   _**Prompt**_
   
   Are there any RDBMS implementations where `CREATE DATABASE` is a synonym for 
`CREATE CATALOG` rather than `CREATE SCHEMA`?
   
   _**Answer**_
   
   **Not as a literal keyword synonym, as far as I know.** I'm not aware of any 
mainstream RDBMS that accepts `CREATE CATALOG` as an alias for `CREATE 
DATABASE`. But the answer changes if you mean "a database that is semantically 
a catalog."
   
   **Where CREATE DATABASE creates a standard-SQL catalog (conceptually)**
   
   In the SQL standard's hierarchy (catalog → schema → object), several major 
systems make "database" the catalog level. None of them has a `CREATE CATALOG` 
statement.
   
   **PostgreSQL**: a database holds schemas, and 
`information_schema.tables.table_catalog` reports the database name. `CREATE 
DATABASE` and `CREATE SCHEMA` are distinct.
   **SQL Server:** same pattern. `TABLE_CATALOG` is the database, and objects 
are named `database.schema.object`.
   **Snowflake, Redshift, and similar warehouses:** `database.schema.table`, 
with `TABLE_CATALOG` holding the database name.
   **MotherDuck/DuckDB:** a MotherDuck `CREATE DATABASE` produces what DuckDB 
treats as a catalog (an attached database), and schemas live inside it.
   
   **Where CREATE DATABASE is the schema level**
   
   **MySQL / MariaDB:** `CREATE SCHEMA` is documented as a synonym for `CREATE 
DATABASE`.
   **Spark SQL / Databricks:** `CREATE DATABASE` is an alias for `CREATE 
SCHEMA`. Unity Catalog adds a separate `CREATE CATALOG` above it.
   **Hive, Impala:** `DATABASE` and `SCHEMA` are interchangeable.
   **Flink SQL, StarRocks, Doris:** they have both `CREATE CATALOG` and `CREATE 
DATABASE`, with the database sitting inside the catalog (i.e., at the schema 
level).
   
   **A reverse oddity: Firebird/InterBase**
   
   Historically, `CREATE SCHEMA` was a synonym for `CREATE DATABASE` in these 
systems, and it created a whole database file. Firebird 6 introduces real 
schemas, which changes this.
   
   So if you've seen something claim `CREATE DATABASE` ≡ `CREATE CATALOG`, it's 
most likely describing the semantic mapping in PostgreSQL/SQL Server-style 
systems rather than an actual syntactic alias. If you have a specific engine in 
mind, I can check its current docs, since some newer engines add syntax quickly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to