Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg_store with example.dump failed #83

Open
molinjun opened this issue May 12, 2017 · 0 comments
Open

pg_store with example.dump failed #83

molinjun opened this issue May 12, 2017 · 0 comments

Comments

@molinjun
Copy link

molinjun commented May 12, 2017

I have installed pg with docker locally, and I can access it successfully. I have created the user craig ,database pgguide。However, when I restore the dump file as sub command, I encounter with a error。

 $ pg_restore --no-owner -h localhost --dbname pgguide example.dump
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2251; 0 0 COMMENT EXTENSION plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of extension plpgsql
    Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';



pg_restore: [archiver (db)] Error from TOC entry 2252; 0 0 COMMENT EXTENSION hstore
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of extension hstore
    Command was: COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';



pg_restore: [archiver (db)] Error from TOC entry 166; 1259 444692 TABLE products craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "products" already exists
    Command was: CREATE TABLE products (
    id integer NOT NULL,
    title character varying(255),
    price numeric,
    created_at timesta...
pg_restore: [archiver (db)] Error from TOC entry 165; 1259 444690 SEQUENCE products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "products_id_seq" already exists
    Command was: CREATE SEQUENCE products_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2253; 0 0 SEQUENCE OWNED BY products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products_id_seq
    Command was: ALTER SEQUENCE products_id_seq OWNED BY products.id;



pg_restore: [archiver (db)] Error from TOC entry 2254; 0 0 SEQUENCE SET products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence products_id_seq
    Command was: SELECT pg_catalog.setval('products_id_seq', 20, true);



pg_restore: [archiver (db)] Error from TOC entry 168; 1259 444703 TABLE purchase_items craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchase_items" already exists
    Command was: CREATE TABLE purchase_items (
    id integer NOT NULL,
    purchase_id integer,
    product_id integer,
    price numeric,
 ...
pg_restore: [archiver (db)] Error from TOC entry 167; 1259 444701 SEQUENCE purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchase_items_id_seq" already exists
    Command was: CREATE SEQUENCE purchase_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2255; 0 0 SEQUENCE OWNED BY purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items_id_seq
    Command was: ALTER SEQUENCE purchase_items_id_seq OWNED BY purchase_items.id;



pg_restore: [archiver (db)] Error from TOC entry 2256; 0 0 SEQUENCE SET purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence purchase_items_id_seq
    Command was: SELECT pg_catalog.setval('purchase_items_id_seq', 1458, true);



pg_restore: [archiver (db)] Error from TOC entry 162; 1259 444669 TABLE purchases craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchases" already exists
    Command was: CREATE TABLE purchases (
    id integer NOT NULL,
    created_at timestamp with time zone,
    name character varying(255),
...
pg_restore: [archiver (db)] Error from TOC entry 161; 1259 444667 SEQUENCE purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchases_id_seq" already exists
    Command was: CREATE SEQUENCE purchases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2257; 0 0 SEQUENCE OWNED BY purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases_id_seq
    Command was: ALTER SEQUENCE purchases_id_seq OWNED BY purchases.id;



pg_restore: [archiver (db)] Error from TOC entry 2258; 0 0 SEQUENCE SET purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence purchases_id_seq
    Command was: SELECT pg_catalog.setval('purchases_id_seq', 1000, true);



pg_restore: [archiver (db)] Error from TOC entry 164; 1259 444680 TABLE users craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "users" already exists
    Command was: CREATE TABLE users (
    id integer NOT NULL,
    email character varying(255),
    password character varying(255),
    det...
pg_restore: [archiver (db)] Error from TOC entry 163; 1259 444678 SEQUENCE users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "users_id_seq" already exists
    Command was: CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2259; 0 0 SEQUENCE OWNED BY users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users_id_seq
    Command was: ALTER SEQUENCE users_id_seq OWNED BY users.id;



pg_restore: [archiver (db)] Error from TOC entry 2260; 0 0 SEQUENCE SET users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence users_id_seq
    Command was: SELECT pg_catalog.setval('users_id_seq', 50, true);



pg_restore: [archiver (db)] Error from TOC entry 2232; 2604 444695 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products
    Command was: ALTER TABLE ONLY products ALTER COLUMN id SET DEFAULT nextval('products_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2233; 2604 444706 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items ALTER COLUMN id SET DEFAULT nextval('purchase_items_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2230; 2604 444672 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases ALTER COLUMN id SET DEFAULT nextval('purchases_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2231; 2604 444683 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users
    Command was: ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2245; 0 444692 TABLE DATA products craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation products
    Command was: COPY products (id, title, price, created_at, deleted_at, tags) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2246; 0 444703 TABLE DATA purchase_items craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation purchase_items
    Command was: COPY purchase_items (id, purchase_id, product_id, price, quantity, state) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2243; 0 444669 TABLE DATA purchases craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation purchases
    Command was: COPY purchases (id, created_at, name, address, state, zipcode, user_id) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2244; 0 444680 TABLE DATA users craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation users
    Command was: COPY users (id, email, password, details, created_at, deleted_at) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2239; 2606 444700 CONSTRAINT products_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products
    Command was: ALTER TABLE ONLY products
    ADD CONSTRAINT products_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2235; 2606 444677 CONSTRAINT purchases_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases
    ADD CONSTRAINT purchases_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2237; 2606 444688 CONSTRAINT users_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users
    Command was: ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2242; 2606 444715 FK CONSTRAINT purchase_items_product_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items
    ADD CONSTRAINT purchase_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES produc...
pg_restore: [archiver (db)] Error from TOC entry 2241; 2606 444710 FK CONSTRAINT purchase_items_purchase_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items
    ADD CONSTRAINT purchase_items_purchase_id_fkey FOREIGN KEY (purchase_id) REFERENCES purc...
pg_restore: [archiver (db)] Error from TOC entry 2240; 2606 444720 FK CONSTRAINT purchases_user_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases
    ADD CONSTRAINT purchases_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);



WARNING: errors ignored on restore: 32

Is the dump file not latest or I did with a wrong way? beg for ur answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant