cobed95 commented on code in PR #4945:
URL: https://github.com/apache/polaris/pull/4945#discussion_r3549677869
##########
persistence/relational-jdbc/src/main/resources/cockroachdb/schema-v4.sql:
##########
@@ -28,8 +28,8 @@
-- policy_mapping_record, events, idempotency_records, scan_metrics_report,
commit_metrics_report
-- * Compatible with PostgreSQL wire protocol
-CREATE SCHEMA IF NOT EXISTS POLARIS_SCHEMA;
-SET search_path TO POLARIS_SCHEMA;
+CREATE SCHEMA IF NOT EXISTS ${schema};
Review Comment:
To make the above concrete, I've implemented it in
[1ec77a3fc](https://github.com/apache/polaris/pull/4945/commits/1ec77a3fc)
(schema created programmatically in `executeScript`, session schema selected in
`borrowConnection`) and
[3cb5eb7ef](https://github.com/apache/polaris/pull/4945/commits/3cb5eb7ef)
(scripts reduced to pure schema-agnostic DDL). Happy to adjust if you'd
envisioned any of the steps differently.
One nuance that came up in implementation: the `CREATE SCHEMA IF NOT EXISTS`
has to run on a raw (non-schema-selected) connection, because on H2 selecting a
not-yet-existing session schema fails — the schema must exist before regular
connections can be borrowed. `DatasourceOperationsSchemaTest` covers that
pre-bootstrap path against real H2.
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java:
##########
@@ -422,8 +438,7 @@ public static PreparedQuery generateOverlapQuery(
return new PreparedQuery(query.sql(), where.parameters());
}
- static String getFullyQualifiedTableName(String tableName) {
- // TODO: make schema name configurable.
- return "POLARIS_SCHEMA." + tableName;
+ String getFullyQualifiedTableName(String tableName) {
+ return schemaName + "." + tableName;
Review Comment:
To make the proposal above concrete, the unquoted behavior is now documented
in [40ba1f142](https://github.com/apache/polaris/pull/4945/commits/40ba1f142)
(metastore docs, admin tool properties, and the config interface javadoc): the
name is used unquoted, so the database applies its usual identifier case
folding — matching how the hard-coded scripts have always behaved on both
databases. Of course, still very open to reworking this if you'd prefer quoted
identifiers.
--
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]