Permalink
Browse files

Move use of VALUES to new test file.

It turns out that PostgreSQL 8.1 and earlier don't support the `VALUES`
statement. So I moved all the tests in `sql/resultset.sql` to
`sql/valueset.sql` and disabled them for 8.1 and earlier. Then I changed all
the uses of `VALUES` in `sql/resultset.sql` to use either `UNION` queries (for
set- and bag-comparing functions, where order doesn't matter) or temporary
tables (for result-comparing functions, where order does matter).
  • Loading branch information...
theory committed Jul 30, 2009
1 parent a3a3773 commit 975956c6063b63d22f193efa997f2e840c433844
Showing with 2,182 additions and 88 deletions.
  1. +6 −1 Makefile
  2. +5 −5 README.pgtap
  3. +351 −0 expected/valueset.out
  4. +194 −82 sql/resultset.sql
  5. +1,626 −0 sql/valueset.sql
View
@@ -64,10 +64,15 @@ ifeq ($(PGVER_MINOR), 4)
# Do nothing.
else
ifneq ($(PGVER_MINOR), 3)
-# Enum test not supported by 8.2 and earlier.
+# Enum tests not supported by 8.2 and earlier.
TESTS := $(filter-out sql/enumtap.sql,$(TESTS))
REGRESS := $(filter-out enumtap,$(REGRESS))
endif
+ifneq ($(PGVER_MINOR), 2)
+# Values tests not supported by 8.1 and earlier.
+TESTS := $(filter-out sql/valueset.sql,$(TESTS))
+REGRESS := $(filter-out valueset,$(REGRESS))
+endif
endif
endif
endif
View
@@ -766,11 +766,11 @@ second argument may be an array:
);
In general, the use of prepared statements is highly recommended to keep your
-test code SQLish (you can even use `VALUES` statements in prepared
-statements!). But note that, because `results_eq()` does a row-by-row
-comparision, the results of the two query arguments must be in exactly the
-same order, with exactly the same data types, in order to pass. In practical
-terms, it means that you must make sure that your results are never
+test code SQLish (you can even use `VALUES` statements in prepared statements
+in PostgreSQL 8.2 and up!). But note that, because `results_eq()` does a
+row-by-row comparision, the results of the two query arguments must be in
+exactly the same order, with exactly the same data types, in order to pass. In
+practical terms, it means that you must make sure that your results are never
unambiguously ordered.
For example, say that you want to compare queries against a `persons` table.
Oops, something went wrong.

0 comments on commit 975956c

Please sign in to comment.