Skip to content

Commit 320f820

Browse files
author
Neil Conway
committed
Schema-qualify several references to the builtin function length(), to
avoid mistakenly calling a function of the same name that might happen to appear earlier in the schema search path.
1 parent 7ced811 commit 320f820

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/psql/tab-complete.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.164 2007/04/26 22:25:56 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.165 2007/06/13 23:59:47 neilc Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -397,7 +397,7 @@ static const SchemaQuery Query_for_list_of_views = {
397397
"SELECT pg_catalog.quote_ident(c1.relname) "\
398398
" FROM pg_catalog.pg_class c1, pg_catalog.pg_class c2, pg_catalog.pg_index i"\
399399
" WHERE c1.oid=i.indrelid and i.indexrelid=c2.oid"\
400-
" and (%d = length('%s'))"\
400+
" and (%d = pg_catalog.length('%s'))"\
401401
" and pg_catalog.quote_ident(c2.relname)='%s'"\
402402
" and pg_catalog.pg_table_is_visible(c2.oid)"
403403

@@ -406,15 +406,15 @@ static const SchemaQuery Query_for_list_of_views = {
406406
"SELECT pg_catalog.quote_ident(c2.relname) "\
407407
" FROM pg_catalog.pg_class c1, pg_catalog.pg_class c2, pg_catalog.pg_index i"\
408408
" WHERE c1.oid=i.indrelid and i.indexrelid=c2.oid"\
409-
" and (%d = length('%s'))"\
409+
" and (%d = pg_catalog.length('%s'))"\
410410
" and pg_catalog.quote_ident(c1.relname)='%s'"\
411411
" and pg_catalog.pg_table_is_visible(c2.oid)"
412412

413413
/* the silly-looking length condition is just to eat up the current word */
414414
#define Query_for_list_of_tables_for_trigger \
415415
"SELECT pg_catalog.quote_ident(relname) "\
416416
" FROM pg_catalog.pg_class"\
417-
" WHERE (%d = length('%s'))"\
417+
" WHERE (%d = pg_catalog.length('%s'))"\
418418
" AND oid IN "\
419419
" (SELECT tgrelid FROM pg_catalog.pg_trigger "\
420420
" WHERE pg_catalog.quote_ident(tgname)='%s')"

0 commit comments

Comments
 (0)