diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 8fced44..f9d4577 100644
*** a/src/backend/parser/gram.y
--- b/src/backend/parser/gram.y
*************** static Node *makeRecursiveViewSelect(cha
*** 334,340 ****
  				name_list from_clause from_list opt_array_bounds
  				qualified_name_list any_name any_name_list
  				any_operator expr_list attrs
! 				target_list insert_column_list set_target_list
  				set_clause_list set_clause multiple_set_clause
  				ctext_expr_list ctext_row def_list indirection opt_indirection
  				reloption_list group_clause TriggerFuncArgs select_limit
--- 334,340 ----
  				name_list from_clause from_list opt_array_bounds
  				qualified_name_list any_name any_name_list
  				any_operator expr_list attrs
! 				target_list opt_target_list insert_column_list set_target_list
  				set_clause_list set_clause multiple_set_clause
  				ctext_expr_list ctext_row def_list indirection opt_indirection
  				reloption_list group_clause TriggerFuncArgs select_limit
*************** select_clause:
*** 9259,9265 ****
   * However, this is not checked by the grammar; parse analysis must check it.
   */
  simple_select:
! 			SELECT opt_distinct target_list
  			into_clause from_clause where_clause
  			group_clause having_clause window_clause
  				{
--- 9259,9265 ----
   * However, this is not checked by the grammar; parse analysis must check it.
   */
  simple_select:
! 			SELECT opt_distinct opt_target_list
  			into_clause from_clause where_clause
  			group_clause having_clause window_clause
  				{
*************** ctext_row: '(' ctext_expr_list ')'					{
*** 12215,12220 ****
--- 12215,12224 ----
   *
   *****************************************************************************/
  
+ opt_target_list: target_list						{ $$ = $1; }
+ 			| /* EMPTY */							{ $$ = NIL; }
+ 		;
+ 
  target_list:
  			target_el								{ $$ = list_make1($1); }
  			| target_list ',' target_el				{ $$ = lappend($1, $3); }
diff --git a/src/test/regress/expected/errors.out b/src/test/regress/expected/errors.out
index 4061512..b63cb54 100644
*** a/src/test/regress/expected/errors.out
--- b/src/test/regress/expected/errors.out
*************** select 1;
*** 15,35 ****
  --
  --
  -- SELECT
! -- missing relation name
  select;
! ERROR:  syntax error at or near ";"
! LINE 1: select;
!               ^
  -- no such relation
  select * from nonesuch;
  ERROR:  relation "nonesuch" does not exist
  LINE 1: select * from nonesuch;
                        ^
- -- missing target list
- select from pg_database;
- ERROR:  syntax error at or near "from"
- LINE 1: select from pg_database;
-                ^
  -- bad name in target list
  select nonesuch from pg_database;
  ERROR:  column "nonesuch" does not exist
--- 15,30 ----
  --
  --
  -- SELECT
! -- this used to be a syntax error, but now we allow an empty target list
  select;
! --
! (1 row)
! 
  -- no such relation
  select * from nonesuch;
  ERROR:  relation "nonesuch" does not exist
  LINE 1: select * from nonesuch;
                        ^
  -- bad name in target list
  select nonesuch from pg_database;
  ERROR:  column "nonesuch" does not exist
*************** select * from pg_database where pg_datab
*** 45,56 ****
  ERROR:  column "nonesuch" does not exist
  LINE 1: ...ect * from pg_database where pg_database.datname = nonesuch;
                                                                ^
! -- bad select distinct on syntax, distinct attribute missing
! select distinct on (foobar) from pg_database;
! ERROR:  syntax error at or near "from"
! LINE 1: select distinct on (foobar) from pg_database;
!                                     ^
! -- bad select distinct on syntax, distinct attribute not in target list
  select distinct on (foobar) * from pg_database;
  ERROR:  column "foobar" does not exist
  LINE 1: select distinct on (foobar) * from pg_database;
--- 40,46 ----
  ERROR:  column "nonesuch" does not exist
  LINE 1: ...ect * from pg_database where pg_database.datname = nonesuch;
                                                                ^
! -- bad attribute name in select distinct on
  select distinct on (foobar) * from pg_database;
  ERROR:  column "foobar" does not exist
  LINE 1: select distinct on (foobar) * from pg_database;
diff --git a/src/test/regress/sql/errors.sql b/src/test/regress/sql/errors.sql
index 2ee707c..80d1b62 100644
*** a/src/test/regress/sql/errors.sql
--- b/src/test/regress/sql/errors.sql
*************** select 1;
*** 16,29 ****
  --
  -- SELECT
  
! -- missing relation name
  select;
  
  -- no such relation
  select * from nonesuch;
  
- -- missing target list
- select from pg_database;
  -- bad name in target list
  select nonesuch from pg_database;
  -- bad attribute name on lhs of operator
--- 16,27 ----
  --
  -- SELECT
  
! -- this used to be a syntax error, but now we allow an empty target list
  select;
  
  -- no such relation
  select * from nonesuch;
  
  -- bad name in target list
  select nonesuch from pg_database;
  -- bad attribute name on lhs of operator
*************** select * from pg_database where nonesuch
*** 32,43 ****
  -- bad attribute name on rhs of operator
  select * from pg_database where pg_database.datname = nonesuch;
  
! 
! -- bad select distinct on syntax, distinct attribute missing
! select distinct on (foobar) from pg_database;
! 
! 
! -- bad select distinct on syntax, distinct attribute not in target list
  select distinct on (foobar) * from pg_database;
  
  
--- 30,36 ----
  -- bad attribute name on rhs of operator
  select * from pg_database where pg_database.datname = nonesuch;
  
! -- bad attribute name in select distinct on
  select distinct on (foobar) * from pg_database;
  
  
