Skip to content

Commit 96656f7

Browse files
committed
Try to make 'cross-database references are not implemented' errors a
bit more helpful by identifying the specific qualified name being complained of.
1 parent 6994641 commit 96656f7

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/backend/catalog/namespace.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.62 2004/01/19 19:04:40 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.63 2004/02/13 01:08:20 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -165,7 +165,9 @@ RangeVarGetRelid(const RangeVar *relation, bool failOK)
165165
if (strcmp(relation->catalogname, get_database_name(MyDatabaseId)) != 0)
166166
ereport(ERROR,
167167
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
168-
errmsg("cross-database references are not implemented")));
168+
errmsg("cross-database references are not implemented: \"%s.%s.%s\"",
169+
relation->catalogname, relation->schemaname,
170+
relation->relname)));
169171
}
170172

171173
if (relation->schemaname)
@@ -218,7 +220,9 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation)
218220
if (strcmp(newRelation->catalogname, get_database_name(MyDatabaseId)) != 0)
219221
ereport(ERROR,
220222
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
221-
errmsg("cross-database references are not implemented")));
223+
errmsg("cross-database references are not implemented: \"%s.%s.%s\"",
224+
newRelation->catalogname, newRelation->schemaname,
225+
newRelation->relname)));
222226
}
223227

224228
if (newRelation->istemp)
@@ -1182,7 +1186,8 @@ DeconstructQualifiedName(List *names,
11821186
if (strcmp(catalogname, get_database_name(MyDatabaseId)) != 0)
11831187
ereport(ERROR,
11841188
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1185-
errmsg("cross-database references are not implemented")));
1189+
errmsg("cross-database references are not implemented: %s",
1190+
NameListToString(names))));
11861191
break;
11871192
default:
11881193
ereport(ERROR,

src/backend/parser/parse_expr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.164 2003/11/29 19:51:52 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.165 2004/02/13 01:08:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1115,7 +1115,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
11151115
if (strcmp(name1, get_database_name(MyDatabaseId)) != 0)
11161116
ereport(ERROR,
11171117
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1118-
errmsg("cross-database references are not implemented")));
1118+
errmsg("cross-database references are not implemented: %s",
1119+
NameListToString(cref->fields))));
11191120

11201121
/* Whole-row reference? */
11211122
if (strcmp(name4, "*") == 0)

src/backend/parser/parse_target.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.114 2003/11/29 19:51:52 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.115 2004/02/13 01:08:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -159,7 +159,8 @@ transformTargetList(ParseState *pstate, List *targetlist)
159159
if (strcmp(name1, get_database_name(MyDatabaseId)) != 0)
160160
ereport(ERROR,
161161
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
162-
errmsg("cross-database references are not implemented")));
162+
errmsg("cross-database references are not implemented: %s",
163+
NameListToString(fields))));
163164
schemaname = strVal(lsecond(fields));
164165
relname = strVal(lthird(fields));
165166
break;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy