· 8 years ago · Feb 28, 2018, 08:59 PM
1-- DROP TABLE IF EXISTS item ;
2
3SELECT 'create the "item" table'
4;
5 CREATE TABLE item (
6 guid UUID NOT NULL DEFAULT gen_random_uuid()
7 , level integer NULL
8 , seq integer NULL
9 , prio integer NULL
10 , name varchar (200) NOT NULL
11 , description varchar (4000)
12 , type varchar (50) NOT NULL DEFAULT 'task'
13 , update_time timestamp DEFAULT NOW()
14 , CONSTRAINT pk_daily_issues_guid PRIMARY KEY (guid)
15 ) WITH (
16 OIDS=FALSE
17 );
18
19
20SELECT 'show the columns of the just created table'
21;
22
23 SELECT attrelid::regclass, attnum, attname
24 FROM pg_attribute
25 WHERE attrelid = 'public.item'::regclass
26 AND attnum > 0
27 AND NOT attisdropped
28 ORDER BY attnum
29 ;