copy test from stdin;
ERROR: copy: line 1, Extra data after last expected column
lost synchronization with server, resetting connection
+SET autocommit TO 'on';
select * from test;
b | c
---+---
COPY x from stdin;
ERROR: copy: line 1, Extra data after last expected column
lost synchronization with server, resetting connection
+SET autocommit TO 'on';
-- various COPY options: delimiters, oids, NULL string
COPY x (b, c, d, e) from stdin with oids delimiter ',' null 'x';
-- check results of copy in
COPY basictest (testvarchar) FROM stdin; -- fail
ERROR: copy: line 1, value too long for type character varying(5)
lost synchronization with server, resetting connection
+SET autocommit TO 'on';
COPY basictest (testvarchar) FROM stdin;
select * from basictest;
testint4 | testtext | testvarchar | testnumeric
COPY nulltest FROM stdin; --fail
ERROR: copy: line 1, CopyFrom: Fail to add null value in not null attribute col3
lost synchronization with server, resetting connection
+SET autocommit TO 'on';
COPY nulltest FROM stdin;
select * from nulltest;
col1 | col2 | col3 | col4
-- privileges on functions, languages
-- switch to superuser
\c -
+SET autocommit TO 'on';
REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok
GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
DROP FUNCTION testfunc1(int); -- fail
ERROR: testfunc1: must be owner
\c -
+SET autocommit TO 'on';
DROP FUNCTION testfunc1(int); -- ok
-- restore to sanity
GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC;
ERROR: pg_class_aclcheck: relation 1 not found
-- superuser
\c -
+SET autocommit TO 'on';
select has_table_privilege(current_user,'pg_shadow','select');
has_table_privilege
---------------------
-- clean up
\c regression
+SET autocommit TO 'on';
DROP FUNCTION testfunc2(int);
DROP FUNCTION testfunc4(boolean);
DROP VIEW atestv1;
CREATE TEMP TABLE temptest(col int);
-- test temp table deletion
\c regression
+SET autocommit TO 'on';
SELECT * FROM temptest;
ERROR: Relation "temptest" does not exist
#! /bin/sh
-# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.27 2002/09/04 18:04:57 petere Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.28 2002/10/19 01:35:43 momjian Exp $
me=`basename $0`
: ${TMPDIR=/tmp}
# Set up SQL shell for the test.
# ----------
-PSQL="$bindir/psql -a -q -X $psql_options"
+PSQL="$bindir/psql -q -X $psql_options"
# ----------
# ----------
message "dropping regression test user accounts"
-"$bindir/psql" $psql_options -c 'drop group regressgroup1; drop group regressgroup2; drop user regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null
+"$bindir/psql" $psql_options -c 'SET autocommit TO on;DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null
if [ $? -eq 2 ]; then
echo "$me: could not drop user accounts"
(exit 2); exit
formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
$ECHO_N "test $formatted ... $ECHO_C"
- $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1
+ # use awk to properly output backslashes
+ (echo "SET autocommit TO 'on';"; awk 'BEGIN {printf "\\set ECHO all\n"}'; cat "$inputdir/sql/$1.sql") |
+ $PSQL -d "$dbname" >"$outputdir/results/$1.out" 2>&1
else
# Start a parallel group
$ECHO_N "parallel group ($# tests): $ECHO_C"
for name do
- ( $PSQL -d $dbname <"$inputdir/sql/$name.sql" >"$outputdir/results/$name.out" 2>&1
+ (
+ # use awk to properly output backslashes
+ (echo "SET autocommit TO 'on';"; awk 'BEGIN {printf "\\set ECHO all\n"}'; cat "$inputdir/sql/$name.sql") |
+ $PSQL -d $dbname >"$outputdir/results/$name.out" 2>&1
$ECHO_N " $name$ECHO_C"
) &
done
copy test from stdin;
10 11 12
\.
+SET autocommit TO 'on';
select * from test;
copy test from stdin;
21 22
2002 232 40 50 60 70 80
\.
+SET autocommit TO 'on';
-- various COPY options: delimiters, oids, NULL string
COPY x (b, c, d, e) from stdin with oids delimiter ',' null 'x';
500000,x,45,80,90
notsoshorttext
\.
+SET autocommit TO 'on';
+
COPY basictest (testvarchar) FROM stdin;
short
\.
a b \N d
\.
+SET autocommit TO 'on';
+
COPY nulltest FROM stdin;
a b c \N
\.
-- switch to superuser
\c -
+SET autocommit TO 'on';
+
REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok
GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
DROP FUNCTION testfunc1(int); -- fail
\c -
+SET autocommit TO 'on';
+
DROP FUNCTION testfunc1(int); -- ok
-- restore to sanity
GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC;
-- superuser
\c -
+SET autocommit TO 'on';
+
select has_table_privilege(current_user,'pg_shadow','select');
select has_table_privilege(current_user,'pg_shadow','insert');
-- clean up
\c regression
+SET autocommit TO 'on';
+
DROP FUNCTION testfunc2(int);
DROP FUNCTION testfunc4(boolean);
-- test temp table deletion
\c regression
+SET autocommit TO 'on';
SELECT * FROM temptest;