Rename pq -> pg (postgres has no Q).
This commit is contained in:
17
pg/dup.sql
Normal file
17
pg/dup.sql
Normal 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
24
pg/init.sql
Normal 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
|
||||
);
|
||||
Reference in New Issue
Block a user