]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/rdbms_depend/pgsql/backsql_create.sql
VERY PRELIMINARY support for PostgreSQL and IBM db2
[openldap] / servers / slapd / back-sql / rdbms_depend / pgsql / backsql_create.sql
1 drop table ldap_oc_mappings;
2 create table ldap_oc_mappings
3  (
4         id integer not null primary key,
5         name varchar(64) not null,
6         keytbl varchar(64) not null,
7         keycol varchar(64) not null,
8         create_proc varchar(255),
9         delete_proc varchar(255),
10         expect_return int not null
11 );
12
13 drop table ldap_attr_mappings;
14 create table ldap_attr_mappings
15  (
16         id integer not null primary key,
17         oc_map_id integer not null references ldap_oc_mappings(id),
18         name varchar(255) not null,
19         sel_expr varchar(255) not null,
20         sel_expr_u varchar(255),
21         from_tbls varchar(255) not null,
22         join_where varchar(255),
23         add_proc varchar(255),
24         delete_proc varchar(255),
25         param_order int not null,
26         expect_return int not null
27 );
28
29 drop table ldap_entries;
30 create table ldap_entries
31  (
32         id integer not null primary key,
33         dn varchar(255) not null,
34         oc_map_id integer not null references ldap_oc_mappings(id),
35         parent int NOT NULL,
36         keyval int NOT NULL,
37         UNIQUE ( oc_map_id, keyval ),
38         UNIQUE ( dn )
39 );
40
41 drop table ldap_referrals;
42 create table ldap_referrals
43  (
44         entry_id integer not null references ldap_entries(id),
45         url text not null
46 );
47
48 drop table ldap_entry_objclasses;
49 create table ldap_entry_objclasses
50  (
51         entry_id integer not null references ldap_entries(id),
52         oc_name varchar(64)
53  );
54
55 ----- Apparently PostgreSQL 7.0 does not know concat(); however,
56 ----- back-sql can be configured to use '||' for string concatenation.
57 ----- Those who can't live without concat() can uncomment this:
58 -- drop function concat(text, text);
59 -- create function concat(text, text) returns text as 'select $1 || $2;' language 'sql';
60