Add SQL_ASCII test case
This commit is contained in:
parent
544cafb4d5
commit
c9ceab967c
87
src/test/regress/expected/sql_ascii.out
Normal file
87
src/test/regress/expected/sql_ascii.out
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
drop table computer_terms;
|
||||||
|
ERROR: Relation 'computer_terms' does not exist
|
||||||
|
create table computer_terms(term text, category text, comments char(16));
|
||||||
|
create index computer_terms_index1 on computer_terms using btree(term);
|
||||||
|
create index computer_terms_index2 on computer_terms using btree(category);
|
||||||
|
insert into computer_terms values('computer display', 'X-A01-Y', 'a comment 1');
|
||||||
|
insert into computer_terms values('computer graphics', 'T-B01-Y', 'a comment 2');
|
||||||
|
insert into computer_terms values('computer programmer', 'S-Z01-Y', 'a comment 3');
|
||||||
|
vacuum computer_terms;
|
||||||
|
select * from computer_terms;
|
||||||
|
term | category | comments
|
||||||
|
---------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
computer graphics | T-B01-Y | a comment 2
|
||||||
|
computer programmer | S-Z01-Y | a comment 3
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
select * from computer_terms where category = 'X-A01-Y';
|
||||||
|
term | category | comments
|
||||||
|
------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select * from computer_terms where category ~* 'x-a01-y';
|
||||||
|
term | category | comments
|
||||||
|
------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select * from computer_terms where category like '_-A01-_';
|
||||||
|
term | category | comments
|
||||||
|
------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select * from computer_terms where category like '_-A%';
|
||||||
|
term | category | comments
|
||||||
|
------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
select * from computer_terms where term ~ 'computer [dg]';
|
||||||
|
term | category | comments
|
||||||
|
-------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
computer graphics | T-B01-Y | a comment 2
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
select * from computer_terms where term ~* 'computer [DG]';
|
||||||
|
term | category | comments
|
||||||
|
-------------------+----------+------------------
|
||||||
|
computer display | X-A01-Y | a comment 1
|
||||||
|
computer graphics | T-B01-Y | a comment 2
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
select *,character_length(term) from computer_terms;
|
||||||
|
term | category | comments | length
|
||||||
|
---------------------+----------+------------------+--------
|
||||||
|
computer display | X-A01-Y | a comment 1 | 16
|
||||||
|
computer graphics | T-B01-Y | a comment 2 | 17
|
||||||
|
computer programmer | S-Z01-Y | a comment 3 | 19
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
select *,octet_length(term) from computer_terms;
|
||||||
|
term | category | comments | octet_length
|
||||||
|
---------------------+----------+------------------+--------------
|
||||||
|
computer display | X-A01-Y | a comment 1 | 16
|
||||||
|
computer graphics | T-B01-Y | a comment 2 | 17
|
||||||
|
computer programmer | S-Z01-Y | a comment 3 | 19
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
select *,position('s' in term) from computer_terms;
|
||||||
|
term | category | comments | strpos
|
||||||
|
---------------------+----------+------------------+--------
|
||||||
|
computer display | X-A01-Y | a comment 1 | 12
|
||||||
|
computer graphics | T-B01-Y | a comment 2 | 17
|
||||||
|
computer programmer | S-Z01-Y | a comment 3 | 0
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
select *,substring(term from 10 for 4) from computer_terms;
|
||||||
|
term | category | comments | substr
|
||||||
|
---------------------+----------+------------------+--------
|
||||||
|
computer display | X-A01-Y | a comment 1 | disp
|
||||||
|
computer graphics | T-B01-Y | a comment 2 | grap
|
||||||
|
computer programmer | S-Z01-Y | a comment 3 | prog
|
||||||
|
(3 rows)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user