mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Sequences are now based on int8, not int4, arithmetic. SERIAL pseudo-type
has an alias SERIAL4 and a sister SERIAL8. SERIAL8 is just the same except the created column is type int8 not int4. initdb forced. Note this also breaks any chance of pg_upgrade from 7.1, unless we hack up pg_upgrade to drop and recreate sequences. (Which is not out of the question, but I don't wanna do it.)
This commit is contained in:
@ -79,8 +79,13 @@ autoinc(PG_FUNCTION_ARGS)
|
||||
seqname = DirectFunctionCall1(textin,
|
||||
CStringGetDatum(args[i]));
|
||||
newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
|
||||
/* nextval now returns int64; coerce down to int32 */
|
||||
newvals[chnattrs] = Int32GetDatum((int32) DatumGetInt64(newvals[chnattrs]));
|
||||
if (DatumGetInt32(newvals[chnattrs]) == 0)
|
||||
{
|
||||
newvals[chnattrs] = DirectFunctionCall1(nextval, seqname);
|
||||
newvals[chnattrs] = Int32GetDatum((int32) DatumGetInt64(newvals[chnattrs]));
|
||||
}
|
||||
pfree(DatumGetTextP(seqname));
|
||||
chnattrs++;
|
||||
i++;
|
||||
|
Reference in New Issue
Block a user