File tree 1 file changed +21
-2
lines changed 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.57 2001/06/01 19:52:24 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.58 2001/06/06 22:03:48 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
22
22
#include "miscadmin.h"
23
23
#include "utils/acl.h"
24
24
#include "utils/builtins.h"
25
+ #ifdef MULTIBYTE
26
+ #include "mb/pg_wchar.h"
27
+ #endif
28
+
25
29
26
30
#define SEQ_MAGIC 0x1717
27
31
@@ -523,7 +527,8 @@ setval_and_iscalled(PG_FUNCTION_ARGS)
523
527
524
528
/*
525
529
* Given a 'text' parameter to a sequence function, extract the actual
526
- * sequence name. We downcase the name if it's not double-quoted.
530
+ * sequence name. We downcase the name if it's not double-quoted,
531
+ * and truncate it if it's too long.
527
532
*
528
533
* This is a kluge, really --- should be able to write nextval(seqrel).
529
534
*/
@@ -557,6 +562,20 @@ get_seq_name(text *seqin)
557
562
* rawname = tolower ((unsigned char ) * rawname );
558
563
}
559
564
}
565
+
566
+ /* Truncate name if it's overlength; again, should match scan.l */
567
+ if (strlen (seqname ) >= NAMEDATALEN )
568
+ {
569
+ #ifdef MULTIBYTE
570
+ int len ;
571
+
572
+ len = pg_mbcliplen (seqname , i , NAMEDATALEN - 1 );
573
+ seqname [len ] = '\0' ;
574
+ #else
575
+ seqname [NAMEDATALEN - 1 ] = '\0' ;
576
+ #endif
577
+ }
578
+
560
579
return seqname ;
561
580
}
562
581
You can’t perform that action at this time.
0 commit comments