|
41 | 41 | * with collations that match the remote table's columns, which we can |
42 | 42 | * consider to be user error. |
43 | 43 | * |
44 | | - * Identifier quoting in this file uses duckdb_quote_identifier() rather than |
45 | | - * quote_identifier() because all SQL generated here is sent to pgduck_server |
46 | | - * (DuckDB), not PostgreSQL. DuckDB reserves additional keywords (LAMBDA, |
47 | | - * PIVOT, QUALIFY, etc.) that PostgreSQL does not; duckdb_quote_identifier() |
48 | | - * handles those. |
49 | | - * |
50 | | - * TODO: this file was ported from postgres_fdw and has not been fully audited |
51 | | - * for other DuckDB SQL compatibility issues (e.g. operator syntax, type casts). |
52 | | - * See https://github.com/Snowflake-Labs/pg_lake/issues/277. |
53 | | - * |
54 | 44 | * Portions Copyright (c) 2012-2023, PostgreSQL Global Development Group |
55 | 45 | * |
56 | 46 | *------------------------------------------------------------------------- |
|
91 | 81 | #include "pg_lake/extensions/postgis.h" |
92 | 82 | #include "pg_lake/fdw/pg_lake_table.h" |
93 | 83 | #include "pg_lake/fdw/shippable.h" |
94 | | -#include "pg_lake/pgduck/keywords.h" |
95 | 84 | #include "pg_lake/pgduck/type.h" |
96 | 85 | #include "pg_lake/pgduck/rewrite_query.h" |
97 | 86 | #include "pg_lake/planner/restriction_collector.h" |
@@ -2231,7 +2220,7 @@ deparseAnalyzeSql(StringInfo buf, Relation rel, |
2231 | 2220 | } |
2232 | 2221 | } |
2233 | 2222 |
|
2234 | | - appendStringInfoString(buf, duckdb_quote_identifier(colname)); |
| 2223 | + appendStringInfoString(buf, quote_identifier(colname)); |
2235 | 2224 |
|
2236 | 2225 | *retrieved_attrs = lappend_int(*retrieved_attrs, i + 1); |
2237 | 2226 | } |
@@ -2469,7 +2458,7 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte, |
2469 | 2458 | if (qualify_col) |
2470 | 2459 | ADD_REL_QUALIFIER(buf, GetUniqueRelationIdentifier(rte)); |
2471 | 2460 |
|
2472 | | - appendStringInfoString(buf, duckdb_quote_identifier(colname)); |
| 2461 | + appendStringInfoString(buf, quote_identifier(colname)); |
2473 | 2462 | } |
2474 | 2463 | } |
2475 | 2464 |
|
@@ -2512,7 +2501,7 @@ deparseRelation(StringInfo buf, Relation rel) |
2512 | 2501 | relname = RelationGetRelationName(rel); |
2513 | 2502 |
|
2514 | 2503 | appendStringInfo(buf, "%s.%s", |
2515 | | - duckdb_quote_identifier(nspname), duckdb_quote_identifier(relname)); |
| 2504 | + quote_identifier(nspname), quote_identifier(relname)); |
2516 | 2505 | } |
2517 | 2506 |
|
2518 | 2507 | /* |
@@ -3106,7 +3095,7 @@ deparseOperatorName(StringInfo buf, Form_pg_operator opform) |
3106 | 3095 | opnspname = get_namespace_name(opform->oprnamespace); |
3107 | 3096 | /* Print fully qualified operator name. */ |
3108 | 3097 | appendStringInfo(buf, "OPERATOR(%s.%s)", |
3109 | | - duckdb_quote_identifier(opnspname), opname); |
| 3098 | + quote_identifier(opnspname), opname); |
3110 | 3099 | } |
3111 | 3100 | else |
3112 | 3101 | { |
@@ -3532,7 +3521,7 @@ deparseFieldSelect(FieldSelect *fieldSelect, deparse_expr_cxt *context) |
3532 | 3521 | attr_index, |
3533 | 3522 | false); |
3534 | 3523 |
|
3535 | | - appendStringInfoString(context->buf, duckdb_quote_identifier(field_name)); |
| 3524 | + appendStringInfoString(context->buf, quote_identifier(field_name)); |
3536 | 3525 | } |
3537 | 3526 |
|
3538 | 3527 | /* |
@@ -3767,12 +3756,12 @@ appendFunctionName(Oid funcid, deparse_expr_cxt *context) |
3767 | 3756 | const char *schemaname; |
3768 | 3757 |
|
3769 | 3758 | schemaname = get_namespace_name(procform->pronamespace); |
3770 | | - appendStringInfo(buf, "%s.", duckdb_quote_identifier(schemaname)); |
| 3759 | + appendStringInfo(buf, "%s.", quote_identifier(schemaname)); |
3771 | 3760 | } |
3772 | 3761 |
|
3773 | 3762 | /* Always print the function name */ |
3774 | 3763 | proname = NameStr(procform->proname); |
3775 | | - appendStringInfoString(buf, duckdb_quote_identifier(proname)); |
| 3764 | + appendStringInfoString(buf, quote_identifier(proname)); |
3776 | 3765 |
|
3777 | 3766 | ReleaseSysCache(proctup); |
3778 | 3767 | } |
|
0 commit comments