Обсуждение:

Поиск
Список
Период
Сортировка

От
"Vasoczki Ferenc"
Дата:
Hi!
=20
I have several problems with pg_dump, and pg_restore, and pgadmin.
=20
1. Pgadmin:
I have 2 Postgresql 8.2. One is on my machine (localhost, windows XP SP2),
and one on the server (debian linux).
I dumped my db from my database.=20
As you wrote here
(http://archives.postgresql.org/pgadmin-support/2006-11/msg00133.php), it
just calls the binary from the command line and sets the params.
=20
C:\Program Files\pgAdmin III\1.6\pg_dump.exe -i -h localhost -p 5432 -U
monarchia_uj -F p -O -D -v -f "C:\tmp\123.sql" monarchia_uj
=20
Ok, the first problem is: It allow me to save with any extension, but the
default is .sql, while when i want to restore, it supposes a .backup.
This isn't a really bug, just now too usable.
=20
I join to this opinion:
=20

Under Windows it won't remember the location I've saved dump to.

Instead, I'll always see my home folder. That's quite an unhandy

thing. E.g. I save a dump to c:\dumps and at the next step want to

restore it. Consider it more logical to see c:\dumps in the dialog

window.



No - patches are always welcome :-)


So, the real problem is:
I want to restore this 123.sql into the servers postgresql.
Open pgadmin, connect to server, go to database, right click and restore.
I select the file, and the OK button is disabled. (readonly, grey,
whatever). Why is that, i made my backup with this pgadmin, so it should be
correct backup file.
(I tried, to dump it out from  the console, and restore with pgadmin, there
is the same situation).
=20
Ok, no problem, i can use this dump like an sql query, so do it:
=20
--
-- PostgreSQL database dump
--
=20
SET client_encoding =3D 'SQL_ASCII';
SET standard_conforming_strings =3D off;
SET check_function_bodies =3D false;
SET client_min_messages =3D warning;
SET escape_string_warning =3D off;
=20
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
=20
COMMENT ON SCHEMA public IS 'Standard public schema';
=20

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--
=20
CREATE PROCEDURAL LANGUAGE plpgsql;
=20

SET search_path =3D public, pg_catalog;
=20
SET default_tablespace =3D '';
=20
SET default_with_oids =3D false;
=20
--
-- Name: admin_jogok; Type: TABLE; Schema: public; Owner: monarchia_uj;
Tablespace:=20
--
=20
CREATE TABLE admin_jogok (
    admin_id integer,
    jog_id character varying(100),
    aj_id integer NOT NULL,
    alfuncid character varying(100)
);
=20

ALTER TABLE public.admin_jogok OWNER TO monarchia_uj;
=20
--
-- Name: admin_jogok_aj_id_seq; Type: SEQUENCE; Schema: public; Owner:
monarchia_uj
--
=20
CREATE SEQUENCE admin_jogok_aj_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
=20

ALTER TABLE public.admin_jogok_aj_id_seq OWNER TO monarchia_uj;
=20

--
-- Name: admin_jogok_aj_id_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: monarchia_uj
--
=20
ALTER SEQUENCE admin_jogok_aj_id_seq OWNED BY admin_jogok.aj_id;
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------
=20
The problem is here:
ERROR:  syntax

error at or near "OWNED"
=20
I checked the manual, and i think the syntax is good. If i do it with
pgadmin, then there wont be any table.
If i run it from command line, the linux box says the errors, but create the
tables, and insert the data.
=20
=20
Ferenc Vas=F3czki
=20

Re:

От
Stéphane Schildknecht
Дата:
Vasoczki Ferenc a écrit :
> Hi!
>
> I have several problems with pg_dump, and pg_restore, and pgadmin.
>
> 1. Pgadmin:
> I have 2 Postgresql 8.2. One is on my machine (localhost, windows XP
> SP2), and one on the server (debian linux).
> I dumped my db from my database.
> As you wrote here
> (http://archives.postgresql.org/pgadmin-support/2006-11/msg00133.php),
> it just calls the binary from the command line and sets the params.
>
> C:\Program Files\pgAdmin III\1.6\pg_dump.exe -i -h localhost -p 5432
> -U monarchia_uj -F p -O -D -v -f "C:\tmp\123.sql" monarchia_uj
>
> Ok, the first problem is: It allow me to save with any extension, but
> the default is .sql, while when i want to restore, it supposes a .backup.
> This isn't a really bug, just now too usable.
>
> I join to this opinion:
>
>
>     Under Windows it won't remember the location I've saved dump to.
>     Instead, I'll always see my home folder. That's quite an unhandy
>     thing. E.g. I save a dump to c:\dumps and at the next step want to
>     restore it. Consider it more logical to see c:\dumps in the dialog
>     window.
>
> No - patches are always welcome :-)
> So, the real problem is:
> I want to restore this 123.sql into the servers postgresql.
> Open pgadmin, connect to server, go to database, right click and restore.
> I select the file, and the OK button is disabled. (readonly, grey,
> whatever). Why is that, i made my backup with this pgadmin, so it
> should be correct backup file.
> (I tried, to dump it out from  the console, and restore with pgadmin,
> there is the same situation).
>
> Ok, no problem, i can use this dump like an sql query, so do it:
>
> --
> -- PostgreSQL database dump
> --
>
> SET client_encoding = 'SQL_ASCII';
> SET standard_conforming_strings = off;
> SET check_function_bodies = false;
> SET client_min_messages = warning;
> SET escape_string_warning = off;
>
> --
> -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
> --
>
> COMMENT ON SCHEMA public IS 'Standard public schema';
>
>
> --
> -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
> --
>
> CREATE PROCEDURAL LANGUAGE plpgsql;
>
>
> SET search_path = public, pg_catalog;
>
> SET default_tablespace = '';
>
> SET default_with_oids = false;
>
> --
> -- Name: admin_jogok; Type: TABLE; Schema: public; Owner:
> monarchia_uj; Tablespace:
> --
>
> CREATE TABLE admin_jogok (
>     admin_id integer,
>     jog_id character varying(100),
>     aj_id integer NOT NULL,
>     alfuncid character varying(100)
> );
>
>
> ALTER TABLE public.admin_jogok OWNER TO monarchia_uj;
>
> --
> -- Name: admin_jogok_aj_id_seq; Type: SEQUENCE; Schema: public; Owner:
> monarchia_uj
> --
>
> CREATE SEQUENCE admin_jogok_aj_id_seq
>     INCREMENT BY 1
>     NO MAXVALUE
>     NO MINVALUE
>     CACHE 1;
>
>
> ALTER TABLE public.admin_jogok_aj_id_seq OWNER TO monarchia_uj;
>
>
> --
> -- Name: admin_jogok_aj_id_seq; Type: SEQUENCE OWNED BY; Schema:
> public; Owner: monarchia_uj
> --
>
> ALTER SEQUENCE admin_jogok_aj_id_seq OWNED BY admin_jogok.aj_id;
>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> The problem is here:
> ERROR:  syntax
> error at or near "OWNED"
>
> I checked the manual, and i think the syntax is good. If i do it with
> pgadmin, then there wont be any table.
> If i run it from command line, the linux box says the errors, but
> create the tables, and insert the data.
>
>
> Ferenc Vasóczki
>
Hi,

Are You sure you don't have two instances on your debian box ?
One in 8.1 and the other in 8.2 ?

That could explain the "owned by" error in that it didn't exist in 8.1,
I think.

Regards,
SAS

--
Stéphane SCHILDKNECHT
Président de PostgreSQLFr
06 13 60 37 44 - 09 53 69 97 12
http://www.PostgreSQLFr.org