Re: Importing data in postgres from .sql file

Fabrízio de Royes Mello <[email protected]> Wed, 5 Sep 2012 08:42:34 -0300
Newsgroups gmane.comp.db.postgresql.php
Message-ID <CAFcNs+obYoM0WPGb=BohPG3RHVHoyqWsb9MkVxUHN6v=PcTUCQ@mail.gmail.com>
--f46d042de689ee5f5f04c8f2de77
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

2012/9/5 Archana K N <[email protected]>

>
>     I used the "Export" option in the phpPgAdmin for exporting certain
> database and i got a zip file with .sql file inside it. I dont know how t=
o
> import it back to postgres as i dont see any option for importing. I am a
> bit confused with the psql command prompt. Can anyone please help me to
> import the data back.
>
>

Hi,

You can use the psql command line:

$ unzip -c name_of_your_file.zip | psql -U postgres name_of_your_database

Regards,

--=20
Fabr=EDzio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

--f46d042de689ee5f5f04c8f2de77
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><div class=3D"gmail_quote">2012/9/5 Archana K N <span dir=3D"ltr">&lt;<=
a href=3D"mailto:[email protected]" target=3D"_blank">archanakknn@gmail=
.com</a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=3D"gmail_quote"><br>=A0=A0=A0 I used the &quot;Export&quot; opti=
on in the phpPgAdmin for exporting certain database and i got a zip file wi=
th .sql file inside it. I dont know how to import it back to postgres as i =
dont see any option for importing. I am a bit confused with the psql comman=
d prompt. Can anyone please help me to import the data back.<span class=3D"=
HOEnZb"><font color=3D"#888888"><span><font color=3D"#888888"><br>


=A0=A0=A0=A0 <br></font></span></font></span></div></blockquote><div><br></=
div><div>Hi,</div><div><br></div><div>You can use the psql command line:</d=
iv><div><br></div><div>$ unzip -c name_of_your_file.zip | psql -U postgres =
name_of_your_database</div>
<div>=A0</div><div>Regards,</div><div><br></div><div>--=A0</div></div>Fabr=
=EDzio de Royes Mello<div>Consultoria/Coaching PostgreSQL<br>&gt;&gt; Blog =
sobre TI: <a href=3D"http://fabriziomello.blogspot.com" target=3D"_blank">h=
ttp://fabriziomello.blogspot.com</a><div>
&gt;&gt; Perfil Linkedin:=A0<a href=3D"http://br.linkedin.com/in/fabriziome=
llo" target=3D"_blank">http://br.linkedin.com/in/fabriziomello</a></div><di=
v>&gt;&gt; Twitter:=A0<a href=3D"http://twitter.com/fabriziomello" target=
=3D"_blank">http://twitter.com/fabriziomello</a></div>
</div><br>

--f46d042de689ee5f5f04c8f2de77--