Include "enum" field in column details

This commit is contained in:
Joe Nelson
2014-10-08 16:51:42 -07:00
parent f0bb14d5fd
commit ecff987f31
5 changed files with 206 additions and 155 deletions
+2
View File
@@ -32,6 +32,7 @@ executable dbapi
, warp-tls , warp-tls
, bcrypt , bcrypt
, base64-string , base64-string
, split
Other-Modules: Dbapi Other-Modules: Dbapi
, PgStructure , PgStructure
, PgQuery , PgQuery
@@ -65,3 +66,4 @@ Test-Suite spec
, warp-tls , warp-tls
, bcrypt , bcrypt
, base64-string , base64-string
, split
+32 -9
View File
@@ -11,6 +11,7 @@ import Data.Maybe (mapMaybe)
import Control.Applicative ( (<*>) ) import Control.Applicative ( (<*>) )
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
import Data.List.Split (splitOn)
import qualified Data.Aeson as JSON import qualified Data.Aeson as JSON
@@ -47,6 +48,7 @@ data Column = Column {
, colMaxLen :: Maybe Int , colMaxLen :: Maybe Int
, colPrecision :: Maybe Int , colPrecision :: Maybe Int
, colDefault :: Maybe String , colDefault :: Maybe String
, colEnum :: Maybe [String]
} deriving (Show) } deriving (Show)
instance JSON.ToJSON Column where instance JSON.ToJSON Column where
@@ -59,7 +61,8 @@ instance JSON.ToJSON Column where
, "updatable" .= colUpdatable c , "updatable" .= colUpdatable c
, "maxLen" .= colMaxLen c , "maxLen" .= colMaxLen c
, "precision" .= colPrecision c , "precision" .= colPrecision c
, "default" .= colDefault c ] , "default" .= colDefault c
, "enum" .= colEnum c ]
data TableOptions = TableOptions { data TableOptions = TableOptions {
tblOptcolumns :: [Column] tblOptcolumns :: [Column]
@@ -91,17 +94,36 @@ tables s conn = do
columns :: String -> String -> Connection -> IO [Column] columns :: String -> String -> Connection -> IO [Column]
columns s t conn = do columns s t conn = do
r <- quickQuery conn r <- quickQuery conn
"select table_schema, table_name, column_name, ordinal_position,\ " select info.table_schema as schema, info.table_name as table_name, \
\ is_nullable, data_type, is_updatable,\ \ info.column_name as name, info.ordinal_position as position, \
\ character_maximum_length, numeric_precision,\ \ info.is_nullable as nullable, info.data_type as col_type, \
\ column_default\ \ info.is_updatable as updatable, info.character_maximum_length as max_len, \
\ from information_schema.columns\ \ info.numeric_precision as precision, info.column_default as default_value,\
\ where table_schema = ?\ \ array_to_string(enum_info.vals, ',') as enum \
\ and table_name = ?" [toSql s, toSql t] \ 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 return $ mapMaybe mkColumn r
where 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) Just $ Column (fromSql schema)
(fromSql table) (fromSql table)
(fromSql name) (fromSql name)
@@ -112,6 +134,7 @@ columns s t conn = do
(fromSql maxlen) (fromSql maxlen)
(fromSql precision) (fromSql precision)
(fromSql defVal) (fromSql defVal)
(splitOn "," <$> fromSql enum)
mkColumn _ = Nothing mkColumn _ = Nothing
printTables :: String -> Connection -> IO BL.ByteString printTables :: String -> Connection -> IO BL.ByteString
+1
View File
@@ -27,6 +27,7 @@ spec = around appWithFixture $ do
[json| { [json| {
"integer": 13, "double": 3.14159, "varchar": "testing!" "integer": 13, "double": 3.14159, "varchar": "testing!"
, "boolean": false, "date": "01/01/1900", "money": "$3.99" , "boolean": false, "date": "01/01/1900", "money": "$3.99"
, "enum": ["foo"]
} |] } |]
`shouldRespondWith` 201 `shouldRespondWith` 201
+64 -23
View File
@@ -26,50 +26,91 @@ spec = around appWithFixture $ do
describe "Table info" $ describe "Table info" $
it "is available with OPTIONS verb" $ it "is available with OPTIONS verb" $
request methodOptions "/auto_incrementing_pk" [] "" `shouldRespondWith` [json| request methodOptions "/menagerie" [] "" `shouldRespondWith`
[json|
{ {
"pkey":["id"], "pkey":["integer"],
"columns":[ "columns":[
{ {
"default": null,
"precision": 32, "precision": 32,
"updatable": true, "updatable": true,
"schema": "1", "schema": "1",
"name": "id", "name": "integer",
"type": "integer", "type": "integer",
"maxLen": null, "maxLen": null,
"enum": null,
"nullable": false, "nullable": false,
"position": 1, "position": 1
"default": "nextval('\"1\".auto_incrementing_pk_id_seq'::regclass)"
}, { }, {
"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, "precision": null,
"updatable": true, "updatable": true,
"schema": "1", "schema": "1",
"name": "nullable_string", "name": "varchar",
"type": "character varying",
"maxLen": null,
"nullable": true,
"position": 2,
"default": null
}, {
"precision": null,
"updatable": true,
"schema": "1",
"name": "non_nullable_string",
"type": "character varying", "type": "character varying",
"maxLen": null, "maxLen": null,
"enum": null,
"nullable": false, "nullable": false,
"position": 3, "position": 3
"default": null
}, { }, {
"default": null,
"precision": null, "precision": null,
"updatable": true, "updatable": true,
"schema": "1", "schema": "1",
"name": "inserted_at", "name": "boolean",
"type": "timestamp with time zone", "type": "boolean",
"maxLen": null, "maxLen": null,
"nullable": true, "enum": null,
"position": 4, "nullable": false,
"default": "now()" "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
} }
] ]
} }
+107 -123
View File
@@ -2,9 +2,9 @@
-- PostgreSQL database dump -- PostgreSQL database dump
-- --
-- Dumped from database version 9.3.4 -- Dumped from database version 9.3.5
-- Dumped by pg_dump version 9.3.4 -- Dumped by pg_dump version 9.3.5
-- Started on 2014-10-01 13:41:39 PDT -- Started on 2014-10-07 15:55:44 PDT
SET statement_timeout = 0; SET statement_timeout = 0;
SET lock_timeout = 0; SET lock_timeout = 0;
@@ -14,7 +14,7 @@ SET check_function_bodies = false;
SET client_min_messages = warning; 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 -- Name: 1; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- --
@@ -24,7 +24,7 @@ CREATE SCHEMA "1";
ALTER SCHEMA "1" OWNER TO dbapi_test; 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 -- Name: dbapi; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- --
@@ -34,7 +34,7 @@ CREATE SCHEMA dbapi;
ALTER SCHEMA dbapi OWNER TO dbapi_test; 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 -- Name: private; Type: SCHEMA; Schema: -; Owner: dbapi_test
-- --
@@ -44,7 +44,7 @@ CREATE SCHEMA private;
ALTER SCHEMA private OWNER TO dbapi_test; 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: -- 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) -- TOC entry 2287 (class 0 OID 0)
-- Dependencies: 187 -- Dependencies: 190
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
-- --
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; 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; 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 -- 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; 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 -- Name: update_owner(); Type: FUNCTION; Schema: dbapi; Owner: dbapi_test
-- --
@@ -106,19 +119,7 @@ SET default_tablespace = '';
SET default_with_oids = false; SET default_with_oids = false;
-- --
-- TOC entry 186 (class 1259 OID 281006) -- TOC entry 179 (class 1259 OID 309041)
-- 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)
-- Name: auto_incrementing_pk; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace: -- 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; 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 -- 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; ALTER TABLE "1".auto_incrementing_pk_id_seq OWNER TO dbapi_test;
-- --
-- TOC entry 2291 (class 0 OID 0) -- TOC entry 2289 (class 0 OID 0)
-- Dependencies: 176 -- Dependencies: 180
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test -- 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: -- 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; 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: -- 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; 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 -- 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; ALTER TABLE "1".items_id_seq OWNER TO dbapi_test;
-- --
-- TOC entry 2295 (class 0 OID 0) -- TOC entry 2293 (class 0 OID 0)
-- Dependencies: 179 -- Dependencies: 183
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: 1; Owner: dbapi_test -- 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: -- Name: menagerie; Type: TABLE; Schema: 1; Owner: dbapi_test; Tablespace:
-- --
@@ -217,14 +218,15 @@ CREATE TABLE menagerie (
"varchar" character varying NOT NULL, "varchar" character varying NOT NULL,
"boolean" boolean NOT NULL, "boolean" boolean NOT NULL,
date date 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; 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: -- 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; 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: -- 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; 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: -- 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; 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: -- 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; 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 -- 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; ALTER TABLE private.articles_id_seq OWNER TO dbapi_test;
-- --
-- TOC entry 2301 (class 0 OID 0) -- TOC entry 2299 (class 0 OID 0)
-- Dependencies: 185 -- Dependencies: 189
-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: private; Owner: dbapi_test -- 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; 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 -- 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 -- 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; 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 -- 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; SET search_path = "1", pg_catalog;
-- --
-- TOC entry 2279 (class 0 OID 281006) -- TOC entry 2268 (class 0 OID 309041)
-- Dependencies: 186 -- Dependencies: 179
-- Data for Name: authors_only; Type: TABLE DATA; Schema: 1; Owner: dbapi_test_author
--
--
-- TOC entry 2268 (class 0 OID 280937)
-- Dependencies: 175
-- Data for Name: auto_incrementing_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- Data for Name: auto_incrementing_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- --
-- --
-- TOC entry 2302 (class 0 OID 0) -- TOC entry 2300 (class 0 OID 0)
-- Dependencies: 176 -- Dependencies: 180
-- Name: auto_incrementing_pk_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test -- 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) -- TOC entry 2270 (class 0 OID 309050)
-- Dependencies: 177 -- Dependencies: 181
-- Data for Name: compound_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- Data for Name: compound_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- --
-- --
-- TOC entry 2271 (class 0 OID 280949) -- TOC entry 2271 (class 0 OID 309053)
-- Dependencies: 178 -- Dependencies: 182
-- Data for Name: items; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- 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) -- TOC entry 2301 (class 0 OID 0)
-- Dependencies: 179 -- Dependencies: 183
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: 1; Owner: dbapi_test -- 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) -- TOC entry 2273 (class 0 OID 309058)
-- Dependencies: 180 -- Dependencies: 184
-- Data for Name: menagerie; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- Data for Name: menagerie; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- --
-- --
-- TOC entry 2274 (class 0 OID 280960) -- TOC entry 2274 (class 0 OID 309064)
-- Dependencies: 181 -- Dependencies: 185
-- Data for Name: no_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- Data for Name: no_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test
-- --
-- --
-- TOC entry 2275 (class 0 OID 280966) -- TOC entry 2275 (class 0 OID 309070)
-- Dependencies: 182 -- Dependencies: 186
-- Data for Name: simple_pk; Type: TABLE DATA; Schema: 1; Owner: dbapi_test -- 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; SET search_path = dbapi, pg_catalog;
-- --
-- TOC entry 2276 (class 0 OID 280972) -- TOC entry 2276 (class 0 OID 309076)
-- Dependencies: 183 -- Dependencies: 187
-- Data for Name: auth; Type: TABLE DATA; Schema: dbapi; Owner: dbapi_test -- 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; SET search_path = private, pg_catalog;
-- --
-- TOC entry 2277 (class 0 OID 280978) -- TOC entry 2277 (class 0 OID 309082)
-- Dependencies: 184 -- Dependencies: 188
-- Data for Name: articles; Type: TABLE DATA; Schema: private; Owner: dbapi_test -- Data for Name: articles; Type: TABLE DATA; Schema: private; Owner: dbapi_test
-- --
-- --
-- TOC entry 2304 (class 0 OID 0) -- TOC entry 2302 (class 0 OID 0)
-- Dependencies: 185 -- Dependencies: 189
-- Name: articles_id_seq; Type: SEQUENCE SET; Schema: private; Owner: dbapi_test -- 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; SET search_path = "1", pg_catalog;
-- --
-- TOC entry 2158 (class 2606 OID 281013) -- TOC entry 2146 (class 2606 OID 309094)
-- 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)
-- Name: auto_incrementing_pk_pkey; Type: CONSTRAINT; Schema: 1; Owner: dbapi_test; Tablespace: -- 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: -- 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: -- 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: -- 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: -- 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; 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: -- 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; 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: -- 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; 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 -- 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; 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 -- 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) -- TOC entry 2284 (class 0 OID 0)
-- Dependencies: 11 -- Dependencies: 10
-- Name: 1; Type: ACL; Schema: -; Owner: dbapi_test -- 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; SET search_path = "1", pg_catalog;
-- --
-- TOC entry 2289 (class 0 OID 0) -- TOC entry 2288 (class 0 OID 0)
-- Dependencies: 186 -- Dependencies: 179
-- 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
-- Name: auto_incrementing_pk; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; 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_test;
GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_anonymous; GRANT ALL ON TABLE auto_incrementing_pk TO dbapi_anonymous;
-- --
-- TOC entry 2292 (class 0 OID 0) -- TOC entry 2290 (class 0 OID 0)
-- Dependencies: 176 -- Dependencies: 180
-- Name: auto_incrementing_pk_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; 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 ALL ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_test;
GRANT USAGE ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_anonymous; GRANT USAGE ON SEQUENCE auto_incrementing_pk_id_seq TO dbapi_anonymous;
-- --
-- TOC entry 2293 (class 0 OID 0) -- TOC entry 2291 (class 0 OID 0)
-- Dependencies: 177 -- Dependencies: 181
-- Name: compound_pk; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; 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_test;
GRANT ALL ON TABLE compound_pk TO dbapi_anonymous; GRANT ALL ON TABLE compound_pk TO dbapi_anonymous;
-- --
-- TOC entry 2294 (class 0 OID 0) -- TOC entry 2292 (class 0 OID 0)
-- Dependencies: 178 -- Dependencies: 182
-- Name: items; Type: ACL; Schema: 1; Owner: dbapi_test -- Name: items; Type: ACL; Schema: 1; Owner: dbapi_test
-- --
REVOKE ALL ON TABLE items FROM PUBLIC;
REVOKE ALL ON TABLE items FROM dbapi_test; REVOKE ALL ON TABLE items FROM dbapi_test;
GRANT ALL ON TABLE items TO dbapi_test; GRANT ALL ON TABLE items TO dbapi_test;
GRANT ALL ON TABLE items TO dbapi_anonymous; GRANT ALL ON TABLE items TO dbapi_anonymous;
-- --
-- TOC entry 2296 (class 0 OID 0) -- TOC entry 2294 (class 0 OID 0)
-- Dependencies: 179 -- Dependencies: 183
-- Name: items_id_seq; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; REVOKE ALL ON SEQUENCE items_id_seq FROM dbapi_test;
GRANT ALL ON SEQUENCE items_id_seq TO dbapi_test; GRANT ALL ON SEQUENCE items_id_seq TO dbapi_test;
GRANT USAGE ON SEQUENCE items_id_seq TO dbapi_anonymous; GRANT USAGE ON SEQUENCE items_id_seq TO dbapi_anonymous;
-- --
-- TOC entry 2297 (class 0 OID 0) -- TOC entry 2295 (class 0 OID 0)
-- Dependencies: 180 -- Dependencies: 184
-- Name: menagerie; Type: ACL; Schema: 1; Owner: dbapi_test -- Name: menagerie; Type: ACL; Schema: 1; Owner: dbapi_test
-- --
REVOKE ALL ON TABLE menagerie FROM PUBLIC;
REVOKE ALL ON TABLE menagerie FROM dbapi_test; REVOKE ALL ON TABLE menagerie FROM dbapi_test;
GRANT ALL ON TABLE menagerie TO dbapi_test; GRANT ALL ON TABLE menagerie TO dbapi_test;
GRANT ALL ON TABLE menagerie TO dbapi_anonymous; GRANT ALL ON TABLE menagerie TO dbapi_anonymous;
-- --
-- TOC entry 2298 (class 0 OID 0) -- TOC entry 2296 (class 0 OID 0)
-- Dependencies: 181 -- Dependencies: 185
-- Name: no_pk; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; 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_test;
GRANT ALL ON TABLE no_pk TO dbapi_anonymous; GRANT ALL ON TABLE no_pk TO dbapi_anonymous;
-- --
-- TOC entry 2299 (class 0 OID 0) -- TOC entry 2297 (class 0 OID 0)
-- Dependencies: 182 -- Dependencies: 186
-- Name: simple_pk; Type: ACL; Schema: 1; Owner: dbapi_test -- 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; 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_test;
GRANT ALL ON TABLE simple_pk TO dbapi_anonymous; 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; SET search_path = private, pg_catalog;
-- --
-- TOC entry 2300 (class 0 OID 0) -- TOC entry 2298 (class 0 OID 0)
-- Dependencies: 184 -- Dependencies: 188
-- Name: articles; Type: ACL; Schema: private; Owner: dbapi_test -- Name: articles; Type: ACL; Schema: private; Owner: dbapi_test
-- --
REVOKE ALL ON TABLE articles FROM PUBLIC;
REVOKE ALL ON TABLE articles FROM dbapi_test; REVOKE ALL ON TABLE articles FROM dbapi_test;
GRANT ALL ON TABLE articles TO 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 -- PostgreSQL database dump complete