aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-03-15 16:48:34 +0000
committerBruce Momjian <bruce@momjian.us>1999-03-15 16:48:34 +0000
commit4b583a8a56feb39f54d2fcb5583b10cbdc98972c (patch)
tree7bf97c05ca418ae711d60cf61e924bba1330fec8
parentb53ddbea5ef2c735cf9993fcc8f38a02aa2fa75d (diff)
downloadpostgresql-4b583a8a56feb39f54d2fcb5583b10cbdc98972c.tar.gz
postgresql-4b583a8a56feb39f54d2fcb5583b10cbdc98972c.zip
Allow sequence nextval actions to be case-sensitive.
-rw-r--r--src/backend/parser/parse_func.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 8eb89f4ba96..7b6e2f6ebe5 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.39 1999/02/23 07:51:53 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.40 1999/03/15 16:48:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,7 @@
#include "access/relscan.h"
#include "access/sdir.h"
#include "catalog/catname.h"
+#include "catalog/heap.h"
#include "catalog/indexing.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_proc.h"
@@ -440,7 +441,6 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
if (nodeTag(pair) == T_Ident && ((Ident *) pair)->isRel)
{
-
/*
* a relation
*/
@@ -573,16 +573,21 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
char *seqrel;
text *seqname;
int32 aclcheck_result = -1;
- extern text *lower(text *string);
Assert(length(fargs) == ((funcid == F_SETVAL) ? 2 : 1));
seq = (Const *) lfirst(fargs);
if (!IsA((Node *) seq, Const))
elog(ERROR, "Only constant sequence names are acceptable for function '%s'", funcname);
- seqname = lower((text *) DatumGetPointer(seq->constvalue));
- pfree(DatumGetPointer(seq->constvalue));
- seq->constvalue = PointerGetDatum(seqname);
- seqrel = textout(seqname);
+
+ seqrel = textout((text *) DatumGetPointer(seq->constvalue));
+ if (RelnameFindRelid(seqrel) == InvalidOid)
+ {
+ pfree(seqrel);
+ seqname = lower((text *) DatumGetPointer(seq->constvalue));
+ pfree(DatumGetPointer(seq->constvalue));
+ seq->constvalue = PointerGetDatum(seqname);
+ seqrel = textout(seqname);
+ }
if ((aclcheck_result = pg_aclcheck(seqrel, GetPgUserName(),
(((funcid == F_NEXTVAL) || (funcid == F_SETVAL)) ?