smallserial / serial2

From: "Mike Pultz" <mike(at)mikepultz(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: smallserial / serial2
Date: 2011-04-21 01:27:27
Message-ID: 023001cbffc3$46f77840$d4e668c0$@mikepultz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I use tables all the time that have sequences on smallint's;

I'd like to simplify my create files by not having to create the sequence
first, but I also don't want to give up those 2 bytes per column!

Can this be added?

Mike

--- postgresql-9.0.4/src/backend/parser/parse_utilcmd.c 2011-04-14
23:15:53.000000000 -0400

+++ postgresql-9.0.4.new/src/backend/parser/parse_utilcmd.c 2011-04-20
21:10:26.000000000 -0400

@@ -280,8 +280,15 @@

{

char *typname =
strVal(linitial(column->typeName->names));

- if (strcmp(typname, "serial") == 0 ||

- strcmp(typname, "serial4") == 0)

+ if (strcmp(typname, "smallserial") == 0 ||

+ strcmp(typname, "serial2") == 0)

+ {

+ is_serial = true;

+ column->typeName->names = NIL;

+ column->typeName->typeOid = INT2OID;

+ }

+ else if (strcmp(typname, "serial") == 0 ||

+ strcmp(typname, "serial4") == 0)

{

is_serial = true;

column->typeName->names = NIL;

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-04-21 02:01:43 pgsql: Allow ALTER TABLE name {OF type | NOT OF}.
Previous Message Robert Haas 2011-04-21 01:10:14 Re: Formatting Curmudgeons WAS: MMAP Buffers