diff -c -r postgresql-snapshot/doc/src/sgml/datatype.sgml postgresql-snapshot-new/doc/src/sgml/datatype.sgml
*** postgresql-snapshot/doc/src/sgml/datatype.sgml	2011-06-07 02:54:24.000000000 -0400
--- postgresql-snapshot-new/doc/src/sgml/datatype.sgml	2011-06-07 20:29:52.000000000 -0400
***************
*** 199,204 ****
--- 199,210 ----
        </row>
  
        <row>
+        <entry><type>smallserial</type></entry>
+        <entry><type>serial2</type></entry>
+        <entry>autoincrementing two-byte integer</entry>
+       </row>
+ 
+       <row>
         <entry><type>serial</type></entry>
         <entry><type>serial4</type></entry>
         <entry>autoincrementing four-byte integer</entry>
***************
*** 369,374 ****
--- 375,387 ----
         </row>
  
         <row>
+         <entry><type>smallserial</type></entry>
+         <entry>2 bytes</entry>
+         <entry>small autoincrementing integer</entry>
+         <entry>1 to 32767</entry>
+        </row>
+ 
+        <row>
          <entry><type>serial</></entry>
          <entry>4 bytes</entry>
          <entry>autoincrementing integer</entry>
***************
*** 743,748 ****
--- 756,765 ----
      <title>Serial Types</title>
  
      <indexterm zone="datatype-serial">
+      <primary>smallserial</primary>
+     </indexterm>
+ 
+     <indexterm zone="datatype-serial">
       <primary>serial</primary>
      </indexterm>
  
***************
*** 751,756 ****
--- 768,777 ----
      </indexterm>
  
      <indexterm zone="datatype-serial">
+      <primary>serial2</primary>
+     </indexterm>
+ 
+     <indexterm zone="datatype-serial">
       <primary>serial4</primary>
      </indexterm>
  
***************
*** 769,776 ****
      </indexterm>
  
      <para>
!      The data types <type>serial</type> and <type>bigserial</type>
!      are not true types, but merely
       a notational convenience for creating unique identifier columns
       (similar to the <literal>AUTO_INCREMENT</literal> property
       supported by some other databases). In the current
--- 790,797 ----
      </indexterm>
  
      <para>
!      The data types <type>serial</type>, <type>smallserial</type> and 
!      <type>bigserial</type> are not true types, but merely
       a notational convenience for creating unique identifier columns
       (similar to the <literal>AUTO_INCREMENT</literal> property
       supported by some other databases). In the current
***************
*** 828,834 ****
       the same way, except that they create a <type>bigint</type>
       column.  <type>bigserial</type> should be used if you anticipate
       the use of more than 2<superscript>31</> identifiers over the
!      lifetime of the table.
      </para>
  
      <para>
--- 849,857 ----
       the same way, except that they create a <type>bigint</type>
       column.  <type>bigserial</type> should be used if you anticipate
       the use of more than 2<superscript>31</> identifiers over the
!      lifetime of the table. The type <type>smallserial</type> and
!      <type>serial2</type> also work the same way, execpt that they
!      create a <type>smallint</type> column.
      </para>
  
      <para>
diff -c -r postgresql-snapshot/doc/src/sgml/ecpg.sgml postgresql-snapshot-new/doc/src/sgml/ecpg.sgml
*** postgresql-snapshot/doc/src/sgml/ecpg.sgml	2011-06-07 02:54:24.000000000 -0400
--- postgresql-snapshot-new/doc/src/sgml/ecpg.sgml	2011-06-07 20:19:33.000000000 -0400
***************
*** 845,850 ****
--- 845,855 ----
        </row>
  
        <row>
+        <entry><type>smallserial</type></entry>
+        <entry><type>short</type></entry>
+       </row>
+ 
+       <row>
         <entry><type>serial</type></entry>
         <entry><type>int</type></entry>
        </row>
diff -c -r postgresql-snapshot/doc/src/sgml/func.sgml postgresql-snapshot-new/doc/src/sgml/func.sgml
*** postgresql-snapshot/doc/src/sgml/func.sgml	2011-06-07 02:54:24.000000000 -0400
--- postgresql-snapshot-new/doc/src/sgml/func.sgml	2011-06-07 20:23:09.000000000 -0400
***************
*** 13366,13372 ****
        <row>
         <entry><literal><function>pg_get_serial_sequence(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</function></literal></entry>
         <entry><type>text</type></entry>
!        <entry>get name of the sequence that a <type>serial</type> or <type>bigserial</type> column
         uses</entry>
        </row>
        <row>
--- 13366,13372 ----
        <row>
         <entry><literal><function>pg_get_serial_sequence(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</function></literal></entry>
         <entry><type>text</type></entry>
!        <entry>get name of the sequence that a <type>serial</type>, <type>smallserial</type> or <type>bigserial</type> column
         uses</entry>
        </row>
        <row>
diff -c -r postgresql-snapshot/src/backend/parser/parse_utilcmd.c postgresql-snapshot-new/src/backend/parser/parse_utilcmd.c
*** postgresql-snapshot/src/backend/parser/parse_utilcmd.c	2011-06-07 02:54:24.000000000 -0400
--- postgresql-snapshot-new/src/backend/parser/parse_utilcmd.c	2011-06-07 19:37:55.000000000 -0400
***************
*** 307,313 ****
  	{
  		char	   *typname = strVal(linitial(column->typeName->names));
  
! 		if (strcmp(typname, "serial") == 0 ||
  			strcmp(typname, "serial4") == 0)
  		{
  			is_serial = true;
--- 307,320 ----
  	{
  		char	   *typname = strVal(linitial(column->typeName->names));
  
! 		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;
