Rename pq -> pg (postgres has no Q).

This commit is contained in:
2014-03-20 22:28:33 -07:00
parent 0701a210db
commit 06310ad1cc
2 changed files with 0 additions and 0 deletions

17
pg/dup.sql Normal file
View File

@@ -0,0 +1,17 @@
SELECT
count(f.path) AS Cnt,
f.hash AS Hash,
array_agg(distinct i.path) Paths
FROM
files AS f
INNER JOIN
files i
ON
i.hash = f.hash
GROUP BY
f.hash
HAVING
count(f.path)>1
ORDER BY
Cnt DESC
;

24
pg/init.sql Normal file
View File

@@ -0,0 +1,24 @@
DROP TABLE files;
DROP TABLE original;
DROP TABLE person;
CREATE TABLE files (
hash CHAR(40),
path TEXT
);
CREATE TABLE person (
uid SERIAL UNIQUE,
username TEXT,
name TEXT
);
INSERT INTO person (username, name) VALUES ('wathiede', 'Bill Thiede');
CREATE TABLE original (
uid INTEGER REFERENCES person (uid),
hash CHAR(40) PRIMARY KEY,
header_size INTEGER,
total_size INTEGER,
blob BYTEA
);