aboutsummaryrefslogtreecommitdiff
path: root/contrib/spi/preprocessor/example.sql
blob: 7ecd6ad7e5c9764d326fa3f11813834e662c2388 (plain)
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
28
29
30
31
32
33
34
35
36
37
--  Note the syntax is strict because i have no time to write better perl filter.
--
--  [blank] is 1 blank 
--  at the end of an interesting line must be a [,]  or [--]
--  [ending] must be a , or --  
--  
--  foreign[blank]key[blank]([blank]keyname,..,keyname[blank])[blank]references[blank]table[blank][ending] 
--
--  step1.e < example.sql | step2.pl > foreign_key_triggers.sql
--   
--  step1.e is a simple program that UPPERCASE ALL . I know that is simple implementing in Perl
--  bu i haven't time


CREATE TABLE 
gruppo
(
codice_gruppo  		int4 			NOT NULL,
descrizione         	varchar(32)    		NOT NULL
primary key ( codice_gruppo ) 

) ;

--
-- fa_parte : Appartenenza di una Azienda Conatto o Cliente ad un certo GRUPPO
--

CREATE TABLE 
fa_parte 
(
codice_gruppo   		int4	NOT NULL,
codice_contatto         	int4   	NOT NULL,

primary key ( codice_gruppo,codice_contatto ) ,
foreign key ( codice_gruppo ) references gruppo --
);