From: Devrim GUNDUZ (devrim@gunduz.org)
Date: Fri 30 Sep 2005 - 13:44:06 EEST
Merhaba,
On Fri, 30 Sep 2005, Cenk Saver wrote:
> PostgreSQL 'de pg_dump ile belirli bir table ı dump edebiliyorum. Peki
> belirli bir sql sorgusunun sonucunu dump edebillmem mumkun mu acaba?
Doğrudan böyle bir yol yok ama size başka bir çözüm önerebilirim:
SQL sorgunuzu yeni bir tablo yaratmak için kullanın ve bu tabloyu dump
edin.
Örnek:
===================================================================================
test=# SELECT * from aaa WHERE a>2;
a
--- 3 5 4 (3 rows)test=# CREATE TABLE bbb AS (SELECT * FROM aaa WHERE a>2); SELECT test=# SELECT * from bbb; a --- 3 5 4 (3 rows)
test=# \q [devrim@devrim ~]$ pg_dump test -t bbb -U postgres -c -- -- PostgreSQL database dump --
SET client_encoding = 'UTF8'; SET check_function_bodies = false; SET client_min_messages = warning;
SET search_path = public, pg_catalog;
DROP TABLE public.bbb; SET default_tablespace = '';
SET default_with_oids = false;
-- -- Name: bbb; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --
CREATE TABLE bbb ( a smallint );
ALTER TABLE public.bbb OWNER TO postgres;
-- -- Data for Name: bbb; Type: TABLE DATA; Schema: public; Owner: postgres --
COPY bbb (a) FROM stdin; 3 5 4 \.
-- -- PostgreSQL database dump complete -- ===================================================================================
Saygılar,
-- Devrim GUNDUZ Kivi Bilişim Teknolojileri - http://www.kivi.com.tr devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr http://www.gunduz.org
_______________________________________________
Linux-sunucu mailing list
Linux-sunucu@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-sunucu