File: itest.sql

package info (click to toggle)
postgresql 6.3.2-8
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 19,388 kB
  • ctags: 15,077
  • sloc: ansic: 158,988; sh: 5,379; java: 5,143; yacc: 4,891; tcl: 4,170; sql: 4,120; makefile: 2,615; lex: 906; cpp: 839; python: 836; perl: 678; asm: 70; csh: 5; sed: 2
file content (27 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--
-- Test int8 64-bit integers.
--
drop table qtest;
create table qtest(q1 int8, q2 int8);

insert into qtest values('123','456');
insert into qtest values('123','4567890123456789');
insert into qtest values('4567890123456789','123');
insert into qtest values('4567890123456789','4567890123456789');
insert into qtest values('4567890123456789','-4567890123456789');

select * from qtest;

select q1, -q1 as minus from qtest;

select q1, q2, q1 + q2 as plus from qtest;
select q1, q2, q1 - q2 as minus from qtest;
select q1, q2, q1 * q2 as multiply from qtest
 where q1 < 1000 or (q2 > 0 and q2 < 1000);
--select q1, q2, q1 * q2 as multiply qtest
-- where q1 < '1000'::int8 or (q2 > '0'::int8 and q2 < '1000'::int8);
select q1, q2, q1 / q2 as divide from qtest;

select q1, float8(q1) from qtest;
select q2, float8(q2) from qtest;
select q1, int8(float8(q1)) from qtest;