<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: List the Databases on a PostgreSQL/PgSQL Server</title>
	<atom:link href="http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:22:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mars99</title>
		<link>http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/comment-page-1/#comment-43173</link>
		<dc:creator>Mars99</dc:creator>
		<pubDate>Thu, 14 Oct 2010 15:59:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-43173</guid>
		<description>I assume you normally want to see a list of all databases NOT including the default PostgreSQL databases. For that you can execute the following SQL query:
SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname!=&#039;postgres&#039;;

To use that from the command line (for scripts...e.g. a backup script) you might want to call it using &#039;psql&#039;:
psql --quiet --no-align --tuples-only --dbname=postgres --username=postgres --host=127.0.0.1 --port=5432 --command=&quot;SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname!=&#039;postgres&#039;;&quot;

If you don&#039;t want to be asked by psql for the PostgreSQL password (because you run it in batch script), you need to set the following environment variable in your batch script:
SET PGPASSWORD=yoursecretpassword</description>
		<content:encoded><![CDATA[<p>I assume you normally want to see a list of all databases NOT including the default PostgreSQL databases. For that you can execute the following SQL query:<br />
SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname!=&#8217;postgres&#8217;;</p>
<p>To use that from the command line (for scripts&#8230;e.g. a backup script) you might want to call it using &#8216;psql&#8217;:<br />
psql &#8211;quiet &#8211;no-align &#8211;tuples-only &#8211;dbname=postgres &#8211;username=postgres &#8211;host=127.0.0.1 &#8211;port=5432 &#8211;command=&#8221;SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname!=&#8217;postgres&#8217;;&#8221;</p>
<p>If you don&#8217;t want to be asked by psql for the PostgreSQL password (because you run it in batch script), you need to set the following environment variable in your batch script:<br />
SET PGPASSWORD=yoursecretpassword</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/comment-page-1/#comment-38837</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Thu, 29 Apr 2010 18:31:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-38837</guid>
		<description>select d.datname as name from pg_catalog.pg_database d;</description>
		<content:encoded><![CDATA[<p>select d.datname as name from pg_catalog.pg_database d;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/comment-page-1/#comment-38096</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 13 Mar 2010 11:46:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-38096</guid>
		<description>salamo alikom
can you provide it in sql query .</description>
		<content:encoded><![CDATA[<p>salamo alikom<br />
can you provide it in sql query .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roger pack</title>
		<link>http://www.tech-recipes.com/rx/280/list-the-databases-on-a-postgresqlpgsql-server/comment-page-1/#comment-32442</link>
		<dc:creator>roger pack</dc:creator>
		<pubDate>Thu, 06 Aug 2009 16:17:00 +0000</pubDate>
		<guid isPermaLink="false">guid-fix-me!#comment-32442</guid>
		<description>worked like a charm</description>
		<content:encoded><![CDATA[<p>worked like a charm</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 2/11 queries in 0.632 seconds using memcached
Object Caching 310/314 objects using memcached

Served from: www.tech-recipes.com @ 2012-02-10 09:10:48 -->
