Skip to content

Commit 4fbbbf1

Browse files
authored
Catalog of notes (#412)
1 parent d8db691 commit 4fbbbf1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

postgres/drafts/07_notes.sql

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
BEGIN;
2+
3+
CREATE SCHEMA note ;
4+
5+
CREATE TABLE nature.data (
6+
record_id Text PRIMARY KEY REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
7+
, note Text NOT NULL
8+
) ;
9+
10+
CREATE VIEW layer2.notes AS
11+
SELECT
12+
r.pgc
13+
, d.note
14+
, t.bib
15+
, b.code
16+
, b.year
17+
, b.author
18+
, b.title
19+
FROM
20+
note.data AS d
21+
LEFT JOIN layer0.records AS r ON (d.record_id = r.id)
22+
LEFT JOIN layer0.tables AS t ON (r.table_id = t.id)
23+
LEFT JOIN common.bib AS b ON (t.bib = b.id)
24+
;
25+
26+
COMMIT;

0 commit comments

Comments
 (0)