Include "enum" field in column details
This commit is contained in:
@@ -32,6 +32,7 @@ executable dbapi
|
||||
, warp-tls
|
||||
, bcrypt
|
||||
, base64-string
|
||||
, split
|
||||
Other-Modules: Dbapi
|
||||
, PgStructure
|
||||
, PgQuery
|
||||
@@ -65,3 +66,4 @@ Test-Suite spec
|
||||
, warp-tls
|
||||
, bcrypt
|
||||
, base64-string
|
||||
, split
|
||||
|
||||
+32
-9
@@ -11,6 +11,7 @@ import Data.Maybe (mapMaybe)
|
||||
import Control.Applicative ( (<*>) )
|
||||
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import Data.List.Split (splitOn)
|
||||
|
||||
import qualified Data.Aeson as JSON
|
||||
|
||||
@@ -47,6 +48,7 @@ data Column = Column {
|
||||
, colMaxLen :: Maybe Int
|
||||
, colPrecision :: Maybe Int
|
||||
, colDefault :: Maybe String
|
||||
, colEnum :: Maybe [String]
|
||||
} deriving (Show)
|
||||
|
||||
instance JSON.ToJSON Column where
|
||||
@@ -59,7 +61,8 @@ instance JSON.ToJSON Column where
|
||||
, "updatable" .= colUpdatable c
|
||||
, "maxLen" .= colMaxLen c
|
||||
, "precision" .= colPrecision c
|
||||
, "default" .= colDefault c ]
|
||||
, "default" .= colDefault c
|
||||
, "enum" .= colEnum c ]
|
||||
|
||||
data TableOptions = TableOptions {
|
||||
tblOptcolumns :: [Column]
|
||||
@@ -91,17 +94,36 @@ tables s conn = do
|
||||
columns :: String -> String -> Connection -> IO [Column]
|
||||
columns s t conn = do
|
||||
r <- quickQuery conn
|
||||
"select table_schema, table_name, column_name, ordinal_position,\
|
||||
\ is_nullable, data_type, is_updatable,\
|
||||
\ character_maximum_length, numeric_precision,\
|
||||
\ column_default\
|
||||
\ from information_schema.columns\
|
||||
\ where table_schema = ?\
|
||||
\ and table_name = ?" [toSql s, toSql t]
|
||||
" select info.table_schema as schema, info.table_name as table_name, \
|
||||
\ info.column_name as name, info.ordinal_position as position, \
|
||||
\ info.is_nullable as nullable, info.data_type as col_type, \
|
||||
\ info.is_updatable as updatable, info.character_maximum_length as max_len, \
|
||||
\ info.numeric_precision as precision, info.column_default as default_value,\
|
||||
\ array_to_string(enum_info.vals, ',') as enum \
|
||||
\ from ( \
|
||||
\ select table_schema, table_name, column_name, ordinal_position, \
|
||||
\ is_nullable, data_type, is_updatable, \
|
||||
\ character_maximum_length, numeric_precision, \
|
||||
\ column_default, udt_name \
|
||||
\ from information_schema.columns \
|
||||
\ where table_schema = ? \
|
||||
\ and table_name = ? \
|
||||
\ ) as info \
|
||||
\ left outer join ( \
|
||||
\ select n.nspname as s, \
|
||||
\ t.typname as n, \
|
||||
\ array_agg(e.enumlabel) as vals \
|
||||
\ from pg_type t \
|
||||
\ join pg_enum e on t.oid = e.enumtypid \
|
||||
\ join pg_catalog.pg_namespace n ON n.oid = t.typnamespace \
|
||||
\ group by s, n \
|
||||
\ ) as enum_info \
|
||||
\ on (info.udt_name = enum_info.n) \
|
||||
\order by position" [toSql s, toSql t]
|
||||
return $ mapMaybe mkColumn r
|
||||
|
||||
where
|
||||
mkColumn [schema, table, name, pos, nullable, colT, updatable, maxlen, precision, defVal] =
|
||||
mkColumn [schema, table, name, pos, nullable, colT, updatable, maxlen, precision, defVal, enum] =
|
||||
Just $ Column (fromSql schema)
|
||||
(fromSql table)
|
||||
(fromSql name)
|
||||
@@ -112,6 +134,7 @@ columns s t conn = do
|
||||
(fromSql maxlen)
|
||||
(fromSql precision)
|
||||
(fromSql defVal)
|
||||
(splitOn "," <$> fromSql enum)
|
||||
mkColumn _ = Nothing
|
||||
|
||||
printTables :: String -> Connection -> IO BL.ByteString
|
||||
|
||||
@@ -27,6 +27,7 @@ spec = around appWithFixture $ do
|
||||
[json| {
|
||||
"integer": 13, "double": 3.14159, "varchar": "testing!"
|
||||
, "boolean": false, "date": "01/01/1900", "money": "$3.99"
|
||||
, "enum": ["foo"]
|
||||
} |]
|
||||
`shouldRespondWith` 201
|
||||
|
||||
|
||||
@@ -26,50 +26,91 @@ spec = around appWithFixture $ do
|
||||
|
||||
describe "Table info" $
|
||||
it "is available with OPTIONS verb" $
|
||||
request methodOptions "/auto_incrementing_pk" [] "" `shouldRespondWith` [json|
|
||||
request methodOptions "/menagerie" [] "" `shouldRespondWith`
|
||||
[json|
|
||||
{
|
||||
"pkey":["id"],
|
||||
"pkey":["integer"],
|
||||
"columns":[
|
||||
{
|
||||
"default": null,
|
||||
"precision": 32,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "id",
|
||||
"name": "integer",
|
||||
"type": "integer",
|
||||
"maxLen": null,
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 1,
|
||||
"default": "nextval('\"1\".auto_incrementing_pk_id_seq'::regclass)"
|
||||
"position": 1
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": 53,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "double",
|
||||
"type": "double precision",
|
||||
"maxLen": null,
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 2
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "nullable_string",
|
||||
"type": "character varying",
|
||||
"maxLen": null,
|
||||
"nullable": true,
|
||||
"position": 2,
|
||||
"default": null
|
||||
}, {
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "non_nullable_string",
|
||||
"name": "varchar",
|
||||
"type": "character varying",
|
||||
"maxLen": null,
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 3,
|
||||
"default": null
|
||||
"position": 3
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "inserted_at",
|
||||
"type": "timestamp with time zone",
|
||||
"name": "boolean",
|
||||
"type": "boolean",
|
||||
"maxLen": null,
|
||||
"nullable": true,
|
||||
"position": 4,
|
||||
"default": "now()"
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 4
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "date",
|
||||
"type": "date",
|
||||
"maxLen": null,
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 5
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "money",
|
||||
"type": "money",
|
||||
"maxLen": null,
|
||||
"enum": null,
|
||||
"nullable": false,
|
||||
"position": 6
|
||||
}, {
|
||||
"default": null,
|
||||
"precision": null,
|
||||
"updatable": true,
|
||||
"schema": "1",
|
||||
"name": "enum",
|
||||
"type": "USER-DEFINED",
|
||||
"maxLen": null,
|
||||
"enum": [
|
||||
"foo",
|
||||
"bar"
|
||||
],
|
||||
"nullable": false,
|
||||
"position": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+107
-123
@@ -2,9 +2,9 @@
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 9.3.4
|
||||
-- Dumped by pg_dump version 9.3.4
|
||||
-- Started on 2014-10-01 13:41:39 PDT
|
||||
-- Dumped from database version 9.3.5
|
||||
-- Dumped by pg_dump version 9.3.5
|
||||
-- Started on 2014-10-07 15:55:44 PDT
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
@@ -14,7 +14,7 @@ SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
|
||||
--
|
||||
-- TOC entry 11 (class 2615 OID 280932)
|
||||
-- TOC entry 10 (class 2615 OID 309036)
|
||||
-- Name: 1; Type: SCHEMA; Schema: -; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -24,7 +24,7 @@ CREATE SCHEMA "1";
|
||||
ALTER SCHEMA "1" OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 9 (class 2615 OID 280933)
|
||||
-- TOC entry 15 (class 2615 OID 309037)
|
||||
-- Name: dbapi; Type: SCHEMA; Schema: -; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -34,7 +34,7 @@ CREATE SCHEMA dbapi;
|
||||
ALTER SCHEMA dbapi OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 10 (class 2615 OID 280934)
|
||||
-- TOC entry 9 (class 2615 OID 309038)
|
||||
-- Name: private; Type: SCHEMA; Schema: -; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -44,7 +44,7 @@ CREATE SCHEMA private;
|
||||
ALTER SCHEMA private OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 187 (class 3079 OID 12018)
|
||||
-- TOC entry 190 (class 3079 OID 12018)
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
|
||||
--
|
||||
|
||||
@@ -52,18 +52,31 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2288 (class 0 OID 0)
|
||||
-- Dependencies: 187
|
||||
-- TOC entry 2287 (class 0 OID 0)
|
||||
-- Dependencies: 190
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 571 (class 1247 OID 309112)
|
||||
-- Name: enum_menagerie_type; Type: TYPE; Schema: 1; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE TYPE "1".enum_menagerie_type AS ENUM (
|
||||
'foo',
|
||||
'bar'
|
||||
);
|
||||
|
||||
|
||||
SET search_path = dbapi, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 200 (class 1255 OID 280935)
|
||||
-- TOC entry 203 (class 1255 OID 309039)
|
||||
-- Name: check_role_exists(); Type: FUNCTION; Schema: dbapi; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -83,7 +96,7 @@ $$;
|
||||
ALTER FUNCTION dbapi.check_role_exists() OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 201 (class 1255 OID 280936)
|
||||
-- TOC entry 204 (class 1255 OID 309040)
|
||||
-- Name: update_owner(); Type: FUNCTION; Schema: dbapi; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -106,19 +119,7 @@ SET default_tablespace = '';
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 186 (class 1259 OID 281006)
|
||||
-- Name: authors_only; Type: TABLE; Schema: 1; Owner: dbapi_test_author; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE authors_only (
|
||||
secret character varying NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".authors_only OWNER TO dbapi_test_author;
|
||||
|
||||
--
|
||||
-- TOC entry 175 (class 1259 OID 280937)
|
||||
-- TOC entry 179 (class 1259 OID 309041)
|
||||
-- Name: auto_incrementing_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -133,7 +134,7 @@ CREATE TABLE auto_incrementing_pk (
|
||||
ALTER TABLE "1".auto_incrementing_pk OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 176 (class 1259 OID 280944)
|
||||
-- TOC entry 180 (class 1259 OID 309048)
|
||||
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -148,8 +149,8 @@ CREATE SEQUENCE auto_incrementing_pk_id_seq
|
||||
ALTER TABLE "1".auto_incrementing_pk_id_seq OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 2291 (class 0 OID 0)
|
||||
-- Dependencies: 176
|
||||
-- TOC entry 2289 (class 0 OID 0)
|
||||
-- Dependencies: 180
|
||||
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -157,7 +158,7 @@ ALTER SEQUENCE auto_incrementing_pk_id_seq OWNED BY auto_incrementing_pk.id;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 177 (class 1259 OID 280946)
|
||||
-- TOC entry 181 (class 1259 OID 309050)
|
||||
-- Name: compound_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -171,7 +172,7 @@ CREATE TABLE compound_pk (
|
||||
ALTER TABLE "1".compound_pk OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 178 (class 1259 OID 280949)
|
||||
-- TOC entry 182 (class 1259 OID 309053)
|
||||
-- Name: items; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -183,7 +184,7 @@ CREATE TABLE items (
|
||||
ALTER TABLE "1".items OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 179 (class 1259 OID 280952)
|
||||
-- TOC entry 183 (class 1259 OID 309056)
|
||||
-- Name: items_id_seq; Type: SEQUENCE; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -198,8 +199,8 @@ CREATE SEQUENCE items_id_seq
|
||||
ALTER TABLE "1".items_id_seq OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 2295 (class 0 OID 0)
|
||||
-- Dependencies: 179
|
||||
-- TOC entry 2293 (class 0 OID 0)
|
||||
-- Dependencies: 183
|
||||
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -207,7 +208,7 @@ ALTER SEQUENCE items_id_seq OWNED BY items.id;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 180 (class 1259 OID 280954)
|
||||
-- TOC entry 184 (class 1259 OID 309058)
|
||||
-- Name: menagerie; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -217,14 +218,15 @@ CREATE TABLE menagerie (
|
||||
"varchar" character varying NOT NULL,
|
||||
"boolean" boolean NOT NULL,
|
||||
date date NOT NULL,
|
||||
money money NOT NULL
|
||||
money money NOT NULL,
|
||||
enum "1".enum_menagerie_type NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".menagerie OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 181 (class 1259 OID 280960)
|
||||
-- TOC entry 185 (class 1259 OID 309064)
|
||||
-- Name: no_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -237,7 +239,7 @@ CREATE TABLE no_pk (
|
||||
ALTER TABLE "1".no_pk OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 182 (class 1259 OID 280966)
|
||||
-- TOC entry 186 (class 1259 OID 309070)
|
||||
-- Name: simple_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -252,7 +254,7 @@ ALTER TABLE "1".simple_pk OWNER TO dbapi_test;
|
||||
SET search_path = dbapi, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 183 (class 1259 OID 280972)
|
||||
-- TOC entry 187 (class 1259 OID 309076)
|
||||
-- Name: auth; Type: TABLE; Schema: dbapi; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -268,7 +270,7 @@ ALTER TABLE dbapi.auth OWNER TO dbapi_test;
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 184 (class 1259 OID 280978)
|
||||
-- TOC entry 188 (class 1259 OID 309082)
|
||||
-- Name: articles; Type: TABLE; Schema: private; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -282,7 +284,7 @@ CREATE TABLE articles (
|
||||
ALTER TABLE private.articles OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 185 (class 1259 OID 280984)
|
||||
-- TOC entry 189 (class 1259 OID 309088)
|
||||
-- Name: articles_id_seq; Type: SEQUENCE; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -297,8 +299,8 @@ CREATE SEQUENCE articles_id_seq
|
||||
ALTER TABLE private.articles_id_seq OWNER TO dbapi_test;
|
||||
|
||||
--
|
||||
-- TOC entry 2301 (class 0 OID 0)
|
||||
-- Dependencies: 185
|
||||
-- TOC entry 2299 (class 0 OID 0)
|
||||
-- Dependencies: 189
|
||||
-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -308,7 +310,7 @@ ALTER SEQUENCE articles_id_seq OWNED BY articles.id;
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2140 (class 2604 OID 280986)
|
||||
-- TOC entry 2142 (class 2604 OID 309090)
|
||||
-- Name: id; Type: DEFAULT; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -316,7 +318,7 @@ ALTER TABLE ONLY auto_incrementing_pk ALTER COLUMN id SET DEFAULT nextval('auto_
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2141 (class 2604 OID 280987)
|
||||
-- TOC entry 2143 (class 2604 OID 309091)
|
||||
-- Name: id; Type: DEFAULT; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -326,7 +328,7 @@ ALTER TABLE ONLY items ALTER COLUMN id SET DEFAULT nextval('items_id_seq'::regcl
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2142 (class 2604 OID 280988)
|
||||
-- TOC entry 2144 (class 2604 OID 309092)
|
||||
-- Name: id; Type: DEFAULT; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -336,24 +338,16 @@ ALTER TABLE ONLY articles ALTER COLUMN id SET DEFAULT nextval('articles_id_seq':
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2279 (class 0 OID 281006)
|
||||
-- Dependencies: 186
|
||||
-- Data for Name: authors_only; Type: TABLE DATA; Schema: 1; Owner: dbapi_test_author
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2268 (class 0 OID 280937)
|
||||
-- Dependencies: 175
|
||||
-- TOC entry 2268 (class 0 OID 309041)
|
||||
-- Dependencies: 179
|
||||
-- Data for Name: auto_incrementing_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2302 (class 0 OID 0)
|
||||
-- Dependencies: 176
|
||||
-- TOC entry 2300 (class 0 OID 0)
|
||||
-- Dependencies: 180
|
||||
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -361,16 +355,16 @@ SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 46, true);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2270 (class 0 OID 280946)
|
||||
-- Dependencies: 177
|
||||
-- TOC entry 2270 (class 0 OID 309050)
|
||||
-- Dependencies: 181
|
||||
-- Data for Name: compound_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2271 (class 0 OID 280949)
|
||||
-- Dependencies: 178
|
||||
-- TOC entry 2271 (class 0 OID 309053)
|
||||
-- Dependencies: 182
|
||||
-- Data for Name: items; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -392,8 +386,8 @@ INSERT INTO items (id) VALUES (15);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2303 (class 0 OID 0)
|
||||
-- Dependencies: 179
|
||||
-- TOC entry 2301 (class 0 OID 0)
|
||||
-- Dependencies: 183
|
||||
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -401,24 +395,24 @@ SELECT pg_catalog.setval('items_id_seq', 15, true);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2273 (class 0 OID 280954)
|
||||
-- Dependencies: 180
|
||||
-- TOC entry 2273 (class 0 OID 309058)
|
||||
-- Dependencies: 184
|
||||
-- Data for Name: menagerie; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2274 (class 0 OID 280960)
|
||||
-- Dependencies: 181
|
||||
-- TOC entry 2274 (class 0 OID 309064)
|
||||
-- Dependencies: 185
|
||||
-- Data for Name: no_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2275 (class 0 OID 280966)
|
||||
-- Dependencies: 182
|
||||
-- TOC entry 2275 (class 0 OID 309070)
|
||||
-- Dependencies: 186
|
||||
-- Data for Name: simple_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -427,8 +421,8 @@ SELECT pg_catalog.setval('items_id_seq', 15, true);
|
||||
SET search_path = dbapi, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2276 (class 0 OID 280972)
|
||||
-- Dependencies: 183
|
||||
-- TOC entry 2276 (class 0 OID 309076)
|
||||
-- Dependencies: 187
|
||||
-- Data for Name: auth; Type: TABLE DATA; Schema: dbapi; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -437,16 +431,16 @@ SET search_path = dbapi, pg_catalog;
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2277 (class 0 OID 280978)
|
||||
-- Dependencies: 184
|
||||
-- TOC entry 2277 (class 0 OID 309082)
|
||||
-- Dependencies: 188
|
||||
-- Data for Name: articles; Type: TABLE DATA; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2304 (class 0 OID 0)
|
||||
-- Dependencies: 185
|
||||
-- TOC entry 2302 (class 0 OID 0)
|
||||
-- Dependencies: 189
|
||||
-- Name: articles_id_seq; Type: SEQUENCE SET; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -456,16 +450,7 @@ SELECT pg_catalog.setval('articles_id_seq', 1, false);
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2158 (class 2606 OID 281013)
|
||||
-- Name: authors_only_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test_author; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY authors_only
|
||||
ADD CONSTRAINT authors_only_pkey PRIMARY KEY (secret);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2144 (class 2606 OID 280990)
|
||||
-- TOC entry 2146 (class 2606 OID 309094)
|
||||
-- Name: auto_incrementing_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -474,7 +459,7 @@ ALTER TABLE ONLY auto_incrementing_pk
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2146 (class 2606 OID 280992)
|
||||
-- TOC entry 2148 (class 2606 OID 309096)
|
||||
-- Name: compound_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -483,7 +468,7 @@ ALTER TABLE ONLY compound_pk
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2152 (class 2606 OID 280994)
|
||||
-- TOC entry 2154 (class 2606 OID 309098)
|
||||
-- Name: contacts_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -492,7 +477,7 @@ ALTER TABLE ONLY simple_pk
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2148 (class 2606 OID 280996)
|
||||
-- TOC entry 2150 (class 2606 OID 309100)
|
||||
-- Name: items_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -501,7 +486,7 @@ ALTER TABLE ONLY items
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2150 (class 2606 OID 280998)
|
||||
-- TOC entry 2152 (class 2606 OID 309102)
|
||||
-- Name: menagerie_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -512,7 +497,7 @@ ALTER TABLE ONLY menagerie
|
||||
SET search_path = dbapi, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2154 (class 2606 OID 281000)
|
||||
-- TOC entry 2156 (class 2606 OID 309104)
|
||||
-- Name: auth_pkey; Type: CONSTRAINT; Schema: dbapi; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -523,7 +508,7 @@ ALTER TABLE ONLY auth
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2156 (class 2606 OID 281002)
|
||||
-- TOC entry 2158 (class 2606 OID 309106)
|
||||
-- Name: articles_pkey; Type: CONSTRAINT; Schema: private; Owner: dbapi_test; Tablespace:
|
||||
--
|
||||
|
||||
@@ -534,7 +519,7 @@ ALTER TABLE ONLY articles
|
||||
SET search_path = dbapi, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2159 (class 2620 OID 281004)
|
||||
-- TOC entry 2159 (class 2620 OID 309108)
|
||||
-- Name: ensure_auth_role_exists; Type: TRIGGER; Schema: dbapi; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -544,7 +529,7 @@ CREATE CONSTRAINT TRIGGER ensure_auth_role_exists AFTER INSERT OR UPDATE ON auth
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2160 (class 2620 OID 281005)
|
||||
-- TOC entry 2160 (class 2620 OID 309109)
|
||||
-- Name: articles_owner_track; Type: TRIGGER; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -552,8 +537,8 @@ CREATE TRIGGER articles_owner_track BEFORE INSERT OR UPDATE ON articles FOR EACH
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2285 (class 0 OID 0)
|
||||
-- Dependencies: 11
|
||||
-- TOC entry 2284 (class 0 OID 0)
|
||||
-- Dependencies: 10
|
||||
-- Name: 1; Type: ACL; Schema: -; Owner: dbapi_test
|
||||
--
|
||||
|
||||
@@ -565,98 +550,96 @@ GRANT USAGE ON SCHEMA "1" TO dbapi_anonymous;
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2289 (class 0 OID 0)
|
||||
-- Dependencies: 186
|
||||
-- Name: authors_only; Type: ACL; Schema: 1; Owner: dbapi_test_author
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE authors_only FROM dbapi_test_author;
|
||||
GRANT ALL ON TABLE authors_only TO dbapi_test_author;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2290 (class 0 OID 0)
|
||||
-- Dependencies: 175
|
||||
-- TOC entry 2288 (class 0 OID 0)
|
||||
-- Dependencies: 179
|
||||
-- Name: auto_incrementing_pk; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE auto_incrementing_pk FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE auto_incrementing_pk FROM dbapi_test;
|
||||
GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_test;
|
||||
GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2292 (class 0 OID 0)
|
||||
-- Dependencies: 176
|
||||
-- TOC entry 2290 (class 0 OID 0)
|
||||
-- Dependencies: 180
|
||||
-- Name: auto_incrementing_pk_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON SEQUENCE auto_incrementing_pk_id_seq FROM PUBLIC;
|
||||
REVOKE ALL ON SEQUENCE auto_incrementing_pk_id_seq FROM dbapi_test;
|
||||
GRANT ALL ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_test;
|
||||
GRANT USAGE ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2293 (class 0 OID 0)
|
||||
-- Dependencies: 177
|
||||
-- TOC entry 2291 (class 0 OID 0)
|
||||
-- Dependencies: 181
|
||||
-- Name: compound_pk; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE compound_pk FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE compound_pk FROM dbapi_test;
|
||||
GRANT ALL ON TABLE compound_pk TO dbapi_test;
|
||||
GRANT ALL ON TABLE compound_pk TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2294 (class 0 OID 0)
|
||||
-- Dependencies: 178
|
||||
-- TOC entry 2292 (class 0 OID 0)
|
||||
-- Dependencies: 182
|
||||
-- Name: items; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE items FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE items FROM dbapi_test;
|
||||
GRANT ALL ON TABLE items TO dbapi_test;
|
||||
GRANT ALL ON TABLE items TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2296 (class 0 OID 0)
|
||||
-- Dependencies: 179
|
||||
-- TOC entry 2294 (class 0 OID 0)
|
||||
-- Dependencies: 183
|
||||
-- Name: items_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON SEQUENCE items_id_seq FROM PUBLIC;
|
||||
REVOKE ALL ON SEQUENCE items_id_seq FROM dbapi_test;
|
||||
GRANT ALL ON SEQUENCE items_id_seq TO dbapi_test;
|
||||
GRANT USAGE ON SEQUENCE items_id_seq TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2297 (class 0 OID 0)
|
||||
-- Dependencies: 180
|
||||
-- TOC entry 2295 (class 0 OID 0)
|
||||
-- Dependencies: 184
|
||||
-- Name: menagerie; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE menagerie FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE menagerie FROM dbapi_test;
|
||||
GRANT ALL ON TABLE menagerie TO dbapi_test;
|
||||
GRANT ALL ON TABLE menagerie TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2298 (class 0 OID 0)
|
||||
-- Dependencies: 181
|
||||
-- TOC entry 2296 (class 0 OID 0)
|
||||
-- Dependencies: 185
|
||||
-- Name: no_pk; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE no_pk FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE no_pk FROM dbapi_test;
|
||||
GRANT ALL ON TABLE no_pk TO dbapi_test;
|
||||
GRANT ALL ON TABLE no_pk TO dbapi_anonymous;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 2299 (class 0 OID 0)
|
||||
-- Dependencies: 182
|
||||
-- TOC entry 2297 (class 0 OID 0)
|
||||
-- Dependencies: 186
|
||||
-- Name: simple_pk; Type: ACL; Schema: 1; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE simple_pk FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE simple_pk FROM dbapi_test;
|
||||
GRANT ALL ON TABLE simple_pk TO dbapi_test;
|
||||
GRANT ALL ON TABLE simple_pk TO dbapi_anonymous;
|
||||
@@ -665,16 +648,17 @@ GRANT ALL ON TABLE simple_pk TO dbapi_anonymous;
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
--
|
||||
-- TOC entry 2300 (class 0 OID 0)
|
||||
-- Dependencies: 184
|
||||
-- TOC entry 2298 (class 0 OID 0)
|
||||
-- Dependencies: 188
|
||||
-- Name: articles; Type: ACL; Schema: private; Owner: dbapi_test
|
||||
--
|
||||
|
||||
REVOKE ALL ON TABLE articles FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE articles FROM dbapi_test;
|
||||
GRANT ALL ON TABLE articles TO dbapi_test;
|
||||
|
||||
|
||||
-- Completed on 2014-10-01 13:41:40 PDT
|
||||
-- Completed on 2014-10-07 15:55:44 PDT
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
|
||||
Reference in New Issue
Block a user