Closed jopoly closed 1 year ago
@jopoly, IMHO column_name
will be usefully for oracle_fdw, because this option exists in sqlite_fdw
and firebird_fdw
. Maybe quote_identifiers
option is also usefully.
Column names currently have no meaning in oracle_fdw, since it matches columns by position, not be name.
I know that that is different from other FDWs. It is because oracle_fdw was written before postgres_fdw.
I don't consider changing that, since it would break compatibility for other users.
So currently a column_name
option wouldn't make any sense.
What I can imagine is an option on the foreign table and/or foreign server that specifies that you want to match columns by name. In combination with that, a column_name
column option would make sense.
The difficulty I see with this is that this would have to play well with the case
option.
Any comment on this, @jopoly?
I want to implement column_name
option because I get inspiration from postgres_fdw's test cases.
They have some testcase as below:
ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
SELECT t1.c1, t2."C 1" FROM ft2 t1 JOIN "S 1"."T 1" t2 ON (t1.c1 = t2."C 1") OFFSET 100 LIMIT 10;
SELECT t1."C 1" FROM "S 1"."T 1" t1 left join ft1 t2 join ft2 t3 on (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
I understand. But did you read my comment?
I understood. Thank you for explaining. I would like to close this thread.
Currently, column name on foreign table is the same as the one on remote table by default. If we want to change the column name by ALTER command, we need to support column_name option.
I would like to share the implementation about it. Are you interested?