Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 995299FB30B for ; Fri, 27 Oct 2006 10:55:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 86108-03 for ; Fri, 27 Oct 2006 10:55:27 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by postgresql.org (Postfix) with ESMTP id E67D49FB2D8 for ; Fri, 27 Oct 2006 10:55:26 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id g2so1078950nfe for ; Fri, 27 Oct 2006 06:55:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=YnJwagGpD9MZoZ0qiyV0HgSCQy8C7W/px/dkx77a21UNwSt4ajEzq5Q1IqUg77O8bgmEngGi4O8GIva+UWdnvtj8v3qvFfl+Lp0Ev9hAhVjgC++3cswOX3HiyqACKH7TCJIKVtjUW6j143K6dBbQxx/jEft2tuOBM2J5KYtKWq4= Received: by 10.48.80.20 with SMTP id d20mr918969nfb; Fri, 27 Oct 2006 06:55:24 -0700 (PDT) Received: by 10.48.217.1 with HTTP; Fri, 27 Oct 2006 06:55:24 -0700 (PDT) Message-ID: Date: Fri, 27 Oct 2006 10:55:24 -0300 From: "=?ISO-8859-1?Q?William_Leite_Ara=FAjo?=" To: "Jon Horsman" Subject: Re: How to query information schema from shell script Cc: pgsql-sql@postgresql.org In-Reply-To: <4f4c2a010610270631q73de201tb98446f64b942a0e@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_44824_28787602.1161957324392" References: <4f4c2a010610270631q73de201tb98446f64b942a0e@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.605 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/216 X-Sequence-Number: 26605 ------=_Part_44824_28787602.1161957324392 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline You can use "-c" option of psql client. Ex.: psql -p 5000 -d database -c "SELECT * FROM information_schema.tables WHERE table_schema =3D 'public'" 2006/10/27, Jon Horsman : > > Hey, > > I'm trying to figure out how i can query the postgres information > schema from a bourne shell script on linux. I need to know if a > user/table exists. Does someone mind giving me a quick example of how > this works, is this possible? > > Thanks, > > Jon. > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > --=20 William Leite Ara=FAjo ------=_Part_44824_28787602.1161957324392 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline      You can use "-c" option of psql client.<= br>     Ex.: psql -p 5000 -d database -c "SELECT *= FROM information_schema.tables WHERE table_schema =3D 'public'"
   

2006/10/27, Jon Horsman <horshaq@gm= ail.com>:
Hey,

I'm trying to figure out how i can query the postgres informati= on
schema from a bourne shell script on linux.  I need to know= if a
user/table exists.  Does someone mind giving me a quick = example of how
this works, is this possible?

Thanks,

Jon.

-----------= ----------------(end of broadcast)---------------------------
TIP 2: Don= 't 'kill -9' the postmaster


--
William Leite Ara=FAjo
------=_Part_44824_28787602.1161957324392--