This patch adds a new regression test for the UPDATE command. Right
now all that is tested is Rod Taylor's recent addition to allow
this syntax:

    UPDATE ... SET <col> = DEFAULT;

If anyone else would like to add more UPDATE tests, go ahead --
I just wanted to write a test for the above functionality, and
couldn't see an existing test that it would be appropriate
to add to.

(Bruce, this patch adds 2 new files, src/test/regress/sql/update.sql
and src/test/regress/expected/update.out)

-Neil

Index: src/test/regress/parallel_schedule
===================================================================
RCS file: /home/neil/cvsup/cvs/pgsql-server/src/test/regress/parallel_schedule,v
retrieving revision 1.21
diff -c -d -r1.21 parallel_schedule
*** src/test/regress/parallel_schedule  1 Jul 2003 19:10:53 -0000       1.21
--- src/test/regress/parallel_schedule  9 Aug 2003 09:09:50 -0000
***************
*** 60,66 ****
  # ----------
  # The fourth group of parallel test
  # ----------
! test: select_into select_distinct select_distinct_on select_implicit select_having 
subselect union case join aggregates transactions random portals arrays btree_index 
hash_index
  
  test: privileges
  test: misc
--- 60,66 ----
  # ----------
  # The fourth group of parallel test
  # ----------
! test: select_into select_distinct select_distinct_on select_implicit select_having 
subselect union case join aggregates transactions random portals arrays btree_index 
hash_index update
  
  test: privileges
  test: misc
Index: src/test/regress/serial_schedule
===================================================================
RCS file: /home/neil/cvsup/cvs/pgsql-server/src/test/regress/serial_schedule,v
retrieving revision 1.20
diff -c -d -r1.20 serial_schedule
*** src/test/regress/serial_schedule    1 Jul 2003 19:10:53 -0000       1.20
--- src/test/regress/serial_schedule    9 Aug 2003 09:10:01 -0000
***************
*** 72,77 ****
--- 72,78 ----
  test: arrays
  test: btree_index
  test: hash_index
+ test: update
  test: privileges
  test: misc
  test: select_views
Index: src/test/regress/expected/update.out
===================================================================
RCS file: src/test/regress/expected/update.out
diff -N src/test/regress/expected/update.out
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- src/test/regress/expected/update.out        9 Aug 2003 09:15:51 -0000
***************
*** 0 ****
--- 1,25 ----
+ --
+ -- UPDATE ... SET <col> = DEFAULT;
+ --
+ CREATE TABLE update_test (
+     a   INT DEFAULT 10,
+     b   INT
+ );
+ INSERT INTO update_test VALUES (5, 10);
+ INSERT INTO update_test VALUES (10, 15);
+ SELECT * FROM update_test;
+  a  | b  
+ ----+----
+   5 | 10
+  10 | 15
+ (2 rows)
+ 
+ UPDATE update_test SET a = DEFAULT, b = DEFAULT;
+ SELECT * FROM update_test;
+  a  | b 
+ ----+---
+  10 |  
+  10 |  
+ (2 rows)
+ 
+ DROP TABLE update_test;
Index: src/test/regress/sql/update.sql
===================================================================
RCS file: src/test/regress/sql/update.sql
diff -N src/test/regress/sql/update.sql
*** /dev/null   1 Jan 1970 00:00:00 -0000
--- src/test/regress/sql/update.sql     9 Aug 2003 09:12:38 -0000
***************
*** 0 ****
--- 1,19 ----
+ --
+ -- UPDATE ... SET <col> = DEFAULT;
+ --
+ 
+ CREATE TABLE update_test (
+     a   INT DEFAULT 10,
+     b   INT
+ );
+ 
+ INSERT INTO update_test VALUES (5, 10);
+ INSERT INTO update_test VALUES (10, 15);
+ 
+ SELECT * FROM update_test;
+ 
+ UPDATE update_test SET a = DEFAULT, b = DEFAULT;
+ 
+ SELECT * FROM update_test;
+ 
+ DROP TABLE update_test;
\ No newline at end of file
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to