Skip to content

Commit 0673dac

Browse files
authored
Merge pull request #3184 from masatake/sql-minor-fixes
SQL: minor updates
2 parents f60a01e + af68835 commit 0673dac

File tree

10 files changed

+256
-62
lines changed

10 files changed

+256
-62
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--sort=no
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
lusiadas input.sql /^CREATE DATABASE lusiadas;$/;" b
2+
sales input.sql /^CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;$/;" b
3+
music input.sql /^CREATE DATABASE music$/;" b
4+
music2 input.sql /^CREATE DATABASE music2$/;" b
5+
test input.sql /^create database 'test' || replace(current_date, '-', '');$/;" b
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Taken from https://www.postgresql.org/docs/current/sql-createdatabase.html
2+
CREATE DATABASE lusiadas;
3+
CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
4+
CREATE DATABASE music
5+
LOCALE 'sv_SE.utf8'
6+
TEMPLATE template0;
7+
CREATE DATABASE music2
8+
LOCALE 'sv_SE.iso885915'
9+
ENCODING LATIN9
10+
TEMPLATE template0;
11+
12+
-- Taken from http://www.hplsql.org/create-database
13+
create database 'test' || replace(current_date, '-', '');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--sort=no
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
myschema input.sql /^CREATE SCHEMA myschema;$/;" S
2+
joe input.sql /^CREATE SCHEMA AUTHORIZATION joe;$/;" S
3+
test input.sql /^CREATE SCHEMA IF NOT EXISTS test AUTHORIZATION joe;$/;" S
4+
hollywood input.sql /^CREATE SCHEMA hollywood$/;" S
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- https://www.postgresql.org/docs/current/sql-createschema.html
2+
CREATE SCHEMA myschema;
3+
CREATE SCHEMA AUTHORIZATION joe;
4+
CREATE SCHEMA IF NOT EXISTS test AUTHORIZATION joe;
5+
CREATE SCHEMA hollywood
6+
CREATE TABLE films (title text, release date, awards text[])
7+
CREATE VIEW winners AS
8+
SELECT title, release FROM films WHERE awards IS NOT NULL;
9+
10+
-- TODO: films and winners should be tagged.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--sort=no
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
neighborhoods input.sql /^CREATE TABLE "neighborhoods" (gid serial,$/;" t
2+
gid input.sql /^CREATE TABLE "neighborhoods" (gid serial,$/;" E table:neighborhoods
3+
objectid input.sql /^"objectid" numeric(10,0),$/;" E table:neighborhoods
4+
pri_neigh_ input.sql /^"pri_neigh_" varchar(3),$/;" E table:neighborhoods
5+
pri_neigh input.sql /^"pri_neigh" varchar(50),$/;" E table:neighborhoods
6+
sec_neigh_ input.sql /^"sec_neigh_" varchar(3),$/;" E table:neighborhoods
7+
sec_neigh input.sql /^"sec_neigh" varchar(50),$/;" E table:neighborhoods
8+
shape_area input.sql /^"shape_area" numeric,$/;" E table:neighborhoods
9+
shape_len input.sql /^"shape_len" numeric);$/;" E table:neighborhoods
10+
neighborhoods_geom_gist input.sql /^CREATE INDEX "neighborhoods_geom_gist" ON "neighborhoods" USING GIST ("geom");$/;" i table:neighborhoods
11+
player input.sql /^CREATE TABLE "player" (uid serial, "name" varchar(50));$/;" t
12+
uid input.sql /^CREATE TABLE "player" (uid serial, "name" varchar(50));$/;" E table:player
13+
name input.sql /^CREATE TABLE "player" (uid serial, "name" varchar(50));$/;" E table:player
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- Based on https://github.com/tonyta/ScrallWall/blob/master/db/data/neighborhoods.sql
2+
SET CLIENT_ENCODING TO UTF8;
3+
SET STANDARD_CONFORMING_STRINGS TO ON;
4+
BEGIN;
5+
CREATE TABLE "neighborhoods" (gid serial,
6+
"objectid" numeric(10,0),
7+
"pri_neigh_" varchar(3),
8+
"pri_neigh" varchar(50),
9+
"sec_neigh_" varchar(3),
10+
"sec_neigh" varchar(50),
11+
"shape_area" numeric,
12+
"shape_len" numeric);
13+
ALTER TABLE "neighborhoods" ADD PRIMARY KEY (gid);
14+
CREATE INDEX "neighborhoods_geom_gist" ON "neighborhoods" USING GIST ("geom");
15+
COMMIT;
16+
17+
BEGIN TRANSACTION;
18+
CREATE TABLE "player" (uid serial, "name" varchar(50));
19+
COMMIT;

0 commit comments

Comments
 (0)