|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.39 1999/02/23 07:51:53 thomas Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.40 1999/03/15 16:48:34 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
21 | 21 | #include "access/relscan.h"
|
22 | 22 | #include "access/sdir.h"
|
23 | 23 | #include "catalog/catname.h"
|
| 24 | +#include "catalog/heap.h" |
24 | 25 | #include "catalog/indexing.h"
|
25 | 26 | #include "catalog/pg_inherits.h"
|
26 | 27 | #include "catalog/pg_proc.h"
|
@@ -440,7 +441,6 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
|
440 | 441 |
|
441 | 442 | if (nodeTag(pair) == T_Ident && ((Ident *) pair)->isRel)
|
442 | 443 | {
|
443 |
| - |
444 | 444 | /*
|
445 | 445 | * a relation
|
446 | 446 | */
|
@@ -573,16 +573,21 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
|
573 | 573 | char *seqrel;
|
574 | 574 | text *seqname;
|
575 | 575 | int32 aclcheck_result = -1;
|
576 |
| - extern text *lower(text *string); |
577 | 576 |
|
578 | 577 | Assert(length(fargs) == ((funcid == F_SETVAL) ? 2 : 1));
|
579 | 578 | seq = (Const *) lfirst(fargs);
|
580 | 579 | if (!IsA((Node *) seq, Const))
|
581 | 580 | elog(ERROR, "Only constant sequence names are acceptable for function '%s'", funcname);
|
582 |
| - seqname = lower((text *) DatumGetPointer(seq->constvalue)); |
583 |
| - pfree(DatumGetPointer(seq->constvalue)); |
584 |
| - seq->constvalue = PointerGetDatum(seqname); |
585 |
| - seqrel = textout(seqname); |
| 581 | + |
| 582 | + seqrel = textout((text *) DatumGetPointer(seq->constvalue)); |
| 583 | + if (RelnameFindRelid(seqrel) == InvalidOid) |
| 584 | + { |
| 585 | + pfree(seqrel); |
| 586 | + seqname = lower((text *) DatumGetPointer(seq->constvalue)); |
| 587 | + pfree(DatumGetPointer(seq->constvalue)); |
| 588 | + seq->constvalue = PointerGetDatum(seqname); |
| 589 | + seqrel = textout(seqname); |
| 590 | + } |
586 | 591 |
|
587 | 592 | if ((aclcheck_result = pg_aclcheck(seqrel, GetPgUserName(),
|
588 | 593 | (((funcid == F_NEXTVAL) || (funcid == F_SETVAL)) ?
|
|
0 commit comments