67b1cb7a创建于 2024年2月1日历史提交
create database test_sql;
\c test_sql;
--for LLT
--test gsql outer help
\! @abs_bindir@/gsql --help | grep command
  -c, --command=COMMAND    run only single command (SQL or internal) and exit
  -f, --file=FILENAME      execute commands from file, then exit
                           execute command file as a single transaction
  -e, --echo-queries       echo commands sent to server
  -E, --echo-hidden        display queries that internal commands generate
  -n, --no-libedit        disable enhanced command line editing (libedit)
  -S, --single-line        single-line mode (end of line terminates SQL command)
  -P, --pset=VAR[=ARG]     set printing option VAR to ARG (see \pset command)
For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within gsql, or consult the gsql section in the openGauss documentation.
--test gsql inner help
\?
General
  \copyright             show openGauss usage and distribution terms
  \g [FILE] or ;         execute query (and send results to file or |pipe)
  \h(\help) [NAME]              help on syntax of SQL commands, * for all commands
  \parallel [on [num]|off] toggle status of execute (currently off)
  \q                     quit gsql

Query Buffer
  \e [FILE] [LINE]       edit the query buffer (or file) with external editor
  \ef [FUNCNAME [LINE]]  edit function definition with external editor
  \p                     show the contents of the query buffer
  \r                     reset (clear) the query buffer
  \w FILE                write query buffer to file

Input/Output
  \copy ...              perform SQL COPY with data stream to the client host
  \echo [STRING]         write string to standard output
  \i FILE                execute commands from file
  \i+ FILE KEY           execute commands from encrypted file
  \ir FILE               as \i, but relative to location of current script
  \ir+ FILE KEY          as \i+, but relative to location of current script
  \o [FILE]              send all query results to file or |pipe
  \qecho [STRING]        write string to query output stream (see \o)

Informational
  (options: S = show system objects, + = additional detail)
  \d[S+]                 list tables, views, and sequences
  \d[S+]  NAME           describe table, view, sequence, or index
  \da[S]  [PATTERN]      list aggregates
  \db[+]  [PATTERN]      list tablespaces
  \dc[S+] [PATTERN]      list conversions
  \dC[+]  [PATTERN]      list casts
  \dd[S]  [PATTERN]      show object descriptions not displayed elsewhere
  \ddp    [PATTERN]      list default privileges
  \dD[S+] [PATTERN]      list domains
  \ded[+] [PATTERN]      list data sources
  \det[+] [PATTERN]      list foreign tables
  \des[+] [PATTERN]      list foreign servers
  \deu[+] [PATTERN]      list user mappings
  \dew[+] [PATTERN]      list foreign-data wrappers
  \df[antw][S+] [PATRN]  list [only agg/normal/trigger/window] functions
  \dF[+]  [PATTERN]      list text search configurations
  \dFd[+] [PATTERN]      list text search dictionaries
  \dFp[+] [PATTERN]      list text search parsers
  \dFt[+] [PATTERN]      list text search templates
  \dg[+]  [PATTERN]      list roles
  \di[S+] [PATTERN]      list indexes
  \dl                    list large objects, same as \lo_list
  \dL[S+] [PATTERN]      list procedural languages
  \dm[S+] [PATTERN]      list materialized views
  \dn[S+] [PATTERN]      list schemas
  \do[S]  [PATTERN]      list operators
  \dO[S+] [PATTERN]      list collations
  \dp     [PATTERN]      list table, view, and sequence access privileges
  \drds [PATRN1 [PATRN2]] list per-database role settings
  \ds[S+] [PATTERN]      list sequences
  \dt[S+] [PATTERN]      list tables
  \dT[S+] [PATTERN]      list data types
  \du[+]  [PATTERN]      list roles
  \dv[S+] [PATTERN]      list views
  \dE[S+] [PATTERN]      list foreign tables
  \dx[+]  [PATTERN]      list extensions
  \dy     [PATTERN]      list event triggers
  \l[+]                  list all databases
  \sf[+] FUNCNAME        show a function's definition
  \z      [PATTERN]      same as \dp

Formatting
  \a                     toggle between unaligned and aligned output mode
  \C [STRING]            set table title, or unset if none
  \f [STRING]            show or set field separator for unaligned query output
  \H                     toggle HTML output mode (currently off)
  \pset NAME [VALUE]     set table output option
                         (NAME := {format|border|expanded|fieldsep|fieldsep_zero|footer|null|
                         numericlocale|recordsep|recordsep_zero|tuples_only|title|tableattr|pager|
                         feedback})
  \t [on|off]            show only rows (currently off)
  \T [STRING]            set HTML <table> tag attributes, or unset if none
  \x [on|off|auto]       toggle expanded output (currently off)

Connection
  \c[onnect] [DBNAME|- USER|- HOST|- PORT|-]
                         connect to new database (currently "test_sql")
  \encoding [ENCODING]   show or set client encoding
  \conninfo              display information about current connection

Operating System
  \cd [DIR]              change the current working directory
  \setenv NAME [VALUE]   set or unset environment variable
  \timing [on|off]       toggle timing of commands (currently off)
  \! [COMMAND]           execute command in shell or start interactive shell

Variables
  \prompt [TEXT] NAME    prompt user to set internal variable
  \set [NAME [VALUE]]    set internal variable, or list all if no parameters
  \unset NAME            unset (delete) internal variable

Large Objects
  \lo_export LOBOID FILE
  \lo_import FILE [COMMENT]
  \lo_list
  \lo_unlink LOBOID      large object operations
--test syntax help
\h nohelp
No help available for "nohelp".
Try \h with no arguments to see available help.
--show a function's source code
\sf pg_table_size
CREATE OR REPLACE FUNCTION pg_catalog.pg_table_size(regclass)
 RETURNS bigint
 LANGUAGE internal
 STRICT NOT FENCED NOT SHIPPABLE
AS $function$pg_table_size$function$;
--show user info
create user gaussuser password 'gauss@123';
\du gaussuser
           List of roles
 Role name | Attributes | Member of 
-----------+------------+-----------
 gaussuser |            | {}

drop user gaussuser;
--show seq info
create table tbl_seq(col1 int,col2 int);
create sequence seq_test start 1 increment 2 owned by tbl_seq.col1;
\d seq_test
          Sequence "public.seq_test"
    Column     |  Type   |        Value        
---------------+---------+---------------------
 sequence_name | name    | seq_test
 last_value    | bigint  | 1
 start_value   | bigint  | 1
 increment_by  | bigint  | 2
 max_value     | bigint  | 9223372036854775807
 min_value     | bigint  | 1
 cache_value   | bigint  | 1
 log_cnt       | bigint  | 0
 is_cycled     | boolean | f
 is_called     | boolean | f
--? uuid          | bigint  | .*
Owned by: public.tbl_seq.col1

\! echo -n 'JJ	123'	\.| @abs_bindir@/gsql -X -d test_sql -p @portstring@ -c "create table gsql_c_copy(name varchar2(10),age integer);copy gsql_c_copy from STDIN;"
CREATE TABLE
ERROR:  invalid input syntax for integer: "123 ."
CONTEXT:  COPY gsql_c_copy, line 1, column age: "123 ."
\! @abs_bindir@/gsql -X -d test_sql -p @portstring@ -c "drop table gsql_c_copy;"
DROP TABLE
--select_audit_log test
select * from pg_delete_audit('1111-1-1','2222-2-2');
 pg_delete_audit 
-----------------
 
(1 row)

select detail_info from pg_query_audit('1111-1-1','2222-2-2') where client_conninfo != 'gs_clean@::1' and detail_info like 'select * from pg_delete_audit%';
                      detail_info                      
-------------------------------------------------------
 select * from pg_delete_audit('1111-1-1','2222-2-2');
(1 row)

create table std_table(id int);
\copy std_table from stdout;
\copy std_table from stdout
select * from std_table order by 1;
 id 
----
  1
  2
  3
  4
(4 rows)

drop table std_table;
\! @abs_bindir@/gsql --no-gsqlrc -d test_sql -p @portstring@ -a -c "select 1;"
select 1;
 ?column? 
----------
        1
(1 row)

--test session timeout work with statement timeout.
set session_timeout = 0;
set statement_timeout = 1000;
set session_timeout = 3;
select pg_sleep(2);
ERROR:  canceling statement due to statement timeout
CONTEXT:  referenced column: pg_sleep
--reset session and statement timeout
set session_timeout = 600; 
set statement_timeout = 0;
--test for '~/' in PSQLRC
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -c ""
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -c "select * from lock_cluster_ddl();"  >a.txt 2>&1
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -c "select * from unlock_cluster_ddl();"  >a.txt 2>&1
--add llt for psql
\dFp+
    Text search parser "pg_catalog.default"
     Method      |    Function    | Description 
-----------------+----------------+-------------
 Start parse     | prsd_start     | (internal)
 Get next token  | prsd_nexttoken | (internal)
 End parse       | prsd_end       | (internal)
 Get headline    | prsd_headline  | (internal)
 Get token types | prsd_lextype   | (internal)

        Token types for parser "pg_catalog.default"
   Token name    |               Description                
-----------------+------------------------------------------
 asciihword      | Hyphenated word, all ASCII
 asciiword       | Word, all ASCII
 blank           | Space symbols
 email           | Email address
 entity          | XML entity
 file            | File or path name
 float           | Decimal notation
 host            | Host
 hword           | Hyphenated word, all letters
 hword_asciipart | Hyphenated word part, all ASCII
 hword_numpart   | Hyphenated word part, letters and digits
 hword_part      | Hyphenated word part, all letters
 int             | Signed integer
 numhword        | Hyphenated word, letters and digits
 numword         | Word, letters and digits
 protocol        | Protocol head
 sfloat          | Scientific notation
 tag             | XML tag
 uint            | Unsigned integer
 url             | URL
 url_path        | URL path
 version         | Version number
 word            | Word, all letters
(23 rows)

      Text search parser "pg_catalog.ngram"
     Method      |    Function     | Description 
-----------------+-----------------+-------------
 Start parse     | ngram_start     | 
 Get next token  | ngram_nexttoken | 
 End parse       | ngram_end       | 
 Get headline    | prsd_headline   | (internal)
 Get token types | ngram_lextype   | 

Token types for parser "pg_catalog.ngram"
 Token name  |   Description   
-------------+-----------------
 alnum       | alnum string
 en_word     | english word
 grapsymbol  | graphic symbol
 multisymbol | multiple symbol
 numeric     | numeric data
 zh_words    | chinese words
(6 rows)

      Text search parser "pg_catalog.pound"
     Method      |    Function     | Description 
-----------------+-----------------+-------------
 Start parse     | pound_start     | 
 Get next token  | pound_nexttoken | 
 End parse       | pound_end       | 
 Get headline    | prsd_headline   | (internal)
 Get token types | pound_lextype   | 

Token types for parser "pg_catalog.pound"
 Token name  |   Description   
-------------+-----------------
 alnum       | alnum string
 en_word     | english word
 grapsymbol  | graphic symbol
 multisymbol | multiple symbol
 numeric     | numeric data
 zh_words    | chinese words
(6 rows)

\i+ aes_llt.sql 0123456789abcdef
Invalid password,it must contain at least three kinds of characters
\i+: Missing the key or the key is illegal,must be 8~16 bytes and contain at least three kinds of characters!
--test gsql parallel execute
drop table if exists gsql_parallel_test;
NOTICE:  table "gsql_parallel_test" does not exist, skipping
create table gsql_parallel_test(id int);
--1)don't support parallel in transaction
start transaction;
\parallel 
Parallel within transaction is not supported
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
\parallel
Parallel within transaction is not supported
commit;
--2)test parallel on xxx and parallel all statements
\parallel on 2
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
\parallel
select count(*) from gsql_parallel_test;
 count 
-------
    40
(1 row)

\parallel on 2
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
\parallel
select count(*) from gsql_parallel_test;
 count 
-------
    80
(1 row)

\parallel
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
insert into gsql_parallel_test select generate_series(1,10);
\parallel
select count(*) from gsql_parallel_test;
 count 
-------
   120
(1 row)

--3)test set guc can be passed to server in child process
--NOTICE:parallel execute select and show may cause results returnning confusion
--as ICBC most execute parallel is about insert,it's ok.
set enable_nestloop=off;
\parallel on 1
show enable_nestloop;
show enable_nestloop;
show enable_nestloop;
\parallel
 enable_nestloop 
-----------------
 off
(1 row)

 enable_nestloop 
-----------------
 off
(1 row)

 enable_nestloop 
-----------------
 off
(1 row)

set enable_nestloop=on;
--4)don't support parallel execute on \d e.g. which have no semicolon
\parallel
\d+ gsql_parallel_test
                  Table "public.gsql_parallel_test"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
Has OIDs: no
Options: orientation=row, compression=no

\d+ gsql_parallel_test
                  Table "public.gsql_parallel_test"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
Has OIDs: no
Options: orientation=row, compression=no

\parallel
--5)test set invalid parallel num
\set QUIET off
\parallel on -0.3
The valid parallel num is integer 1-1024.
\parallel on -1
The valid parallel num is integer 1-1024.
\parallel on -1.5
The valid parallel num is integer 1-1024.
\parallel on 0
The valid parallel num is integer 1-1024.
\parallel on
Parallel is on with scale default 1024.
\parallel on 0.9
The valid parallel num is integer 1-1024.
\parallel on 2.3
The valid parallel num is integer 1-1024.
\parallel on 1025
The valid parallel num is integer 1-1024.
\parallel on aa
The valid parallel num is integer 1-1024.
\parallel on 'bb'
The valid parallel num is integer 1-1024.
\parallel off
Parallel is off.
\set QUIET on
drop table gsql_parallel_test;
--6)test parallel execute after through \c to change database and connection messages
create database test_parallel_db;
\c test_parallel_db
create schema test_parallel_schema;
\parallel on
create table test_parallel_schema.test_parallel_table(id int);
\parallel off
\parallel on
table test_parallel_schema.test_parallel_table;
\parallel off
 id 
----
(0 rows)

\c regression
--7)test \d(+) and \d(+) partition table command
create table test_d_command_tbl1(id int);
create table test_d_command_tbl2(id int) with(orientation=column);
create table test_d_command_tbl3(id int) with(orientation=row);
create table test_d_command_tbl4(id int) with(compression=yes);
ERROR:  row-oriented table does not support compression
create index test_d_command_tbl1_idx on test_d_command_tbl1(id);
select relname,reloptions from pg_class where relname like 'test_d_command_tbl%' order by relname;
         relname         |              reloptions              
-------------------------+--------------------------------------
 test_d_command_tbl1     | {orientation=row,compression=no}
 test_d_command_tbl1_idx | 
 test_d_command_tbl2     | {orientation=column,compression=low}
 test_d_command_tbl3     | {orientation=row,compression=no}
(4 rows)

\d+ test_d_command_tbl1
                 Table "public.test_d_command_tbl1"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
Indexes:
    "test_d_command_tbl1_idx" btree (id) TABLESPACE pg_default
Has OIDs: no
Options: orientation=row, compression=no

\d+ test_d_command_tbl2
                 Table "public.test_d_command_tbl2"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
Has OIDs: no
Options: orientation=column, compression=low

\d+ test_d_command_tbl3
                 Table "public.test_d_command_tbl3"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
Has OIDs: no
Options: orientation=row, compression=no

\d+ test_d_command_tbl4
\di test_d_command_tbl1_idx
--?.*
--?.*
--?.*
--?.*
(1 row)

drop table test_d_command_tbl1,test_d_command_tbl2,test_d_command_tbl3,test_d_command_tbl4;
ERROR:  table "test_d_command_tbl4" does not exist
create table test_d_command_part1 (id int,id2 int) partition by range (id2) (partition p1 values less than(2001),partition p2 values less than(2002),partition p3 values less than(2003));
create table test_d_command_part2 (id int,id2 int) partition by range (id,id2) (partition p1 values less than(1,2001),partition p2 values less than(2,2002),partition p3 values less than(3,2003));
\d test_d_command_part1
Table "public.test_d_command_part1"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 id2    | integer | 
Partition By RANGE(id2)
Number of partitions: 3 (View pg_partition to check each partition range.)

\d test_d_command_part2
Table "public.test_d_command_part2"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 id2    | integer | 
Partition By RANGE(id, id2)
Number of partitions: 3 (View pg_partition to check each partition range.)

\d+ test_d_command_part1
                 Table "public.test_d_command_part1"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
 id2    | integer |           | plain   |              | 
Partition By RANGE(id2)
Number of partitions: 3 (View pg_partition to check each partition range.)
Has OIDs: no
Options: orientation=row, compression=no

\d+ test_d_command_part2
                 Table "public.test_d_command_part2"
 Column |  Type   | Modifiers | Storage | Stats target | Description 
--------+---------+-----------+---------+--------------+-------------
 id     | integer |           | plain   |              | 
 id2    | integer |           | plain   |              | 
Partition By RANGE(id, id2)
Number of partitions: 3 (View pg_partition to check each partition range.)
Has OIDs: no
Options: orientation=row, compression=no

drop table test_d_command_part1;
drop table test_d_command_part2;
--8)test gsql parser in debug version
\! echo "--test parse normal                                                                                                    " >> @abs_bindir@/gsql_parser.sql
\! echo "create table exp_alias.static_alias_cursor(c  varchar(20));                                                            " >> @abs_bindir@/gsql_parser.sql
\! echo "--test parse procedure                                                                                                 " >> @abs_bindir@/gsql_parser.sql
\! echo "create or replace  procedure exp_alias.static_alias_cursor                                                             " >> @abs_bindir@/gsql_parser.sql
\! echo "as                                                                                                                     " >> @abs_bindir@/gsql_parser.sql
\! echo "mychar   varchar(20);                                                                                                  " >> @abs_bindir@/gsql_parser.sql
\! echo "begin                                                                                                                  " >> @abs_bindir@/gsql_parser.sql
\! echo "open cursor_static;                                                                                                    " >> @abs_bindir@/gsql_parser.sql
\! echo "loop                                                                                                                   " >> @abs_bindir@/gsql_parser.sql
\! echo "fetch cursor_static into mychar;                                                                                       " >> @abs_bindir@/gsql_parser.sql
\! echo "exit when cursor_static%notfound;                                                                                      " >> @abs_bindir@/gsql_parser.sql
\! echo "insert into exp_alias.static_alias_cursor values(mychar);                                                              " >> @abs_bindir@/gsql_parser.sql
\! echo "end loop;                                                                                                              " >> @abs_bindir@/gsql_parser.sql
\! echo "close cursor_static;                                                                                                   " >> @abs_bindir@/gsql_parser.sql
\! echo "end;                                                                                                                   " >> @abs_bindir@/gsql_parser.sql
\! echo "/" >> @abs_bindir@/gsql_parser.sql
\! echo "call exp_alias.static_alias_cursor();                                                                                  " >> @abs_bindir@/gsql_parser.sql
\! echo "--test parse transaction                                                                                               " >> @abs_bindir@/gsql_parser.sql
\! echo "start transaction;                                                                                                     " >> @abs_bindir@/gsql_parser.sql
\! echo "select p_csp_01_topuprecharge('1397846',20151110000000,20151125235959,1,10);                                           " >> @abs_bindir@/gsql_parser.sql
\! echo "fetch all in xxx; 		                                                                                        " >> @abs_bindir@/gsql_parser.sql
\! echo "commit;                                                                                                                " >> @abs_bindir@/gsql_parser.sql
\! echo "--test parse slash command                                                                                             " >> @abs_bindir@/gsql_parser.sql
\! echo "\d                                                                                                                     " >> @abs_bindir@/gsql_parser.sql
\! echo "--test parse comment                                                                                                   " >> @abs_bindir@/gsql_parser.sql
\! echo "--create table comment(coment varchar(20));                                                                            " >> @abs_bindir@/gsql_parser.sql
\! @abs_bindir@/gsql -p @portstring@ -f @abs_bindir@/gsql_parser.sql -g                                                         >> @abs_bindir@/gsql_parser.out
--9)test verbosity and filename on parallel
\! echo "\set VERBOSITY verbose                                                                                                 " >> @abs_bindir@/gsql_parallel.sql
\! echo "\parallel on 2                                                                                                         " >> @abs_bindir@/gsql_parallel.sql
\! echo "select ab;                                                                                                             " >> @abs_bindir@/gsql_parallel.sql
\! echo "\parallel off                                                                                                          " >> @abs_bindir@/gsql_parallel.sql
\! echo "\set VERBOSITY default                                                                                                 " >> @abs_bindir@/gsql_parallel.sql
-- \! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_parallel.sql
-- \! rm @abs_bindir@/gsql_parser.sql
-- \! rm @abs_bindir@/gsql_parallel.sql
set session_timeout = 3;
\parallel on 3
select pg_sleep(3);
select pg_sleep(3);
select pg_sleep(3);
select pg_sleep(3);
\parallel off
 pg_sleep 
----------
 
(1 row)

 pg_sleep 
----------
 
(1 row)

 pg_sleep 
----------
 
(1 row)

 pg_sleep 
----------
 
(1 row)

drop table if exists dual;
NOTICE:  table "dual" does not exist, skipping
create table dual (dummy varchar(1));
insert into dual values ('X');
select * from dual;
 dummy 
-------
 X
(1 row)

show session_timeout;
 session_timeout 
-----------------
 3s
(1 row)

reset session_timeout;
select left(version(),10);
    left    
------------
 (openGauss
(1 row)

\! echo "select 1" 	>> @abs_bindir@/gsql_cat.sql
\! echo "union all"	>> @abs_bindir@/gsql_cat.sql
\! echo "select 2;"	>> @abs_bindir@/gsql_cat.sql
\! echo "select 3;" >> @abs_bindir@/gsql_cat.sql
\! echo "select 4"	>> @abs_bindir@/gsql_cat.sql
\! cat @abs_bindir@/gsql_cat.sql | @abs_bindir@/gsql -d test_sql -p @portstring@
 ?column? 
----------
        1
        2
(2 rows)

 ?column? 
----------
        3
(1 row)

 ?column? 
----------
        4
(1 row)

\! rm -f @abs_bindir@/gsql_cat.sql
--add test for ut
\! echo '\setenv PSQL_EDITOR "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo '\e '	>> @abs_bindir@/gsql_ut.sql
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
ERROR: Failed to check environment value: invalid token ";".
\! echo '\setenv PSQL_EDITOR "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo '\e @abs_bindir@/gsql_ut.sql'	>> @abs_bindir@/gsql_ut.sql
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
ERROR: Failed to check environment value: invalid token ";".
\! echo '\setenv PSQL_EDITOR "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo '\e  @abs_bindir@/gsql_ut.sql 10'	>> @abs_bindir@/gsql_ut.sql
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
ERROR: Failed to check environment value: invalid token ";".
-- this is not added to V1R7C00 now.
/*
\! echo '\setenv PSQL_EDITOR_LINENUMBER_ARG "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo '\e a.sql'	>> @abs_bindir@/gsql_ut.sql
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
*/
\! echo '\setenv PAGER "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo 'select * from generate_series(1, 300);'	>> @abs_bindir@/gsql_ut.sql
-- \! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
\! echo '\setenv SHELL "this is a bad env; and should make an error"'	> @abs_bindir@/gsql_ut.sql
\! echo '\!'	>> @abs_bindir@/gsql_ut.sql
\! @abs_bindir@/gsql -d test_sql -p @portstring@ -f @abs_bindir@/gsql_ut.sql
ERROR: Failed to check environment value: invalid token ";".
\cd @abs_bindir@
\set FETCH_COUNT 10
select * from generate_series(1, 20);
 generate_series 
-----------------
               1
               2
               3
               4
               5
               6
               7
               8
               9
              10
              11
              12
              13
              14
              15
              16
              17
              18
              19
              20
(20 rows)

\set FETCH_COUNT
\o | echo | head -n 0 | grep -Ev '^$'
select * from dual;
\o
\copyright
GaussDB Kernel Database Management System
Copyright (c) Huawei Technologies Co., Ltd. 2018. All rights reserved.

\c regression;
drop database test_sql;
\! rm -f @abs_bindir@/gsql_ut.sql
-- end of test for ut.
-- --10)test on_error_stop in parallel execute
-- \set ON_ERROR_STOP 'on'
-- start transaction;
-- \parallel
-- insert into gsql_parallel_test select generate_series(1,10);
-- insert into gsql_parallel_test select generate_series(1,10);
-- \parallel