<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Postgres OnLine Journal - beginner</title>
    <link>http://www.postgresonline.com/journal/</link>
    <description>an In depth look at the PostgreSQL open source database</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Sat, 09 Feb 2013 07:37:56 GMT</pubDate>

    <image>
        <url>http://www.postgresonline.com/journal/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Postgres OnLine Journal - beginner - an In depth look at the PostgreSQL open source database</title>
        <link>http://www.postgresonline.com/journal/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>How to add database name to log output</title>
    <link>http://www.postgresonline.com/journal/archives/291-How-to-add-database-name-to-log-output.html</link>
            <category>beginner</category>
            <category>q&amp;a</category>
    
    <comments>http://www.postgresonline.com/journal/archives/291-How-to-add-database-name-to-log-output.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=291</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=291</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;PostgreSQL allows you to customize statement logging in numerous ways. You can globally set the level of logging you want at both the postgresql.conf (that will affect all databases) or at the database level using the various &lt;code&gt;log_statement*&lt;/code&gt; variables.   Most of these
are documented in &lt;a href=&quot;http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html&quot; target=&quot;_blank&quot;&gt;runtime config logging&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For this brief article, we&#039;ll talk about the &lt;a href=&quot;http://www.postgresql.org/docs/current/interactive/runtime-config-logging.html#GUC-LOG-LINE-PREFIX&quot;&gt;&lt;b&gt;log_line_prefix&lt;/b&gt;&lt;/a&gt; variable. By default this variable is very minimalistic and just prefixes the log lines with the date time of the statement.  If you have just one database (like the way Oracle runs) this is not a big deal,
but if you are like us and run several databases on one PostgreSQL instance, it would be nice to as part of the prefix include the database name.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/291-How-to-add-database-name-to-log-output.html#extended&quot;&gt;Continue reading &quot;How to add database name to log output&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 08 Feb 2013 17:06:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/291-guid.html</guid>
    <category>logging</category>

</item>
<item>
    <title>Unknown object type 84 in default privileges</title>
    <link>http://www.postgresonline.com/journal/archives/282-Unknown-object-type-84-in-default-privileges.html</link>
            <category>9.2</category>
            <category>basics</category>
            <category>beginner</category>
            <category>pgadmin</category>
            <category>postgresql versions</category>
    
    <comments>http://www.postgresonline.com/journal/archives/282-Unknown-object-type-84-in-default-privileges.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=282</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=282</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;We recently started upgrading some of our databases on windows 64-bit to 9.2, in doing so we ran into a nasty issue we discovered when some of our backups were failing.  The first time it happened, I chucked it up to a dirty PostgreSQL 8.4 database being restored to PostgreSQL 9.2.1.  The second time it happened restoring a 9.1 database to 9.2.2, I thought, better look into this to see if there is a known issue.  Low and behold I found this:
&lt;a href=&quot;http://archives.postgresql.org/pgsql-bugs/2012-12/msg00091.php&quot; target=&quot;_blank&quot;&gt;http://archives.postgresql.org/pgsql-bugs/2012-12/msg00091.php (Bug #7741)&lt;/a&gt;.  Apparently something to do with granting rights on Types.&lt;/p&gt;

&lt;p&gt;As a workaround for this problem so our backups would work again was to delete the offending permissions from system tables. It&#039;s probably not the best way but only way we could think of, we delete the bad record in &lt;b&gt;pg_default_acl&lt;/b&gt; and after that backup works without complaint.&lt;/p&gt;

&lt;pre&gt;
   &lt;code&gt;&lt;span class=&quot;syntax0&quot;&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;-- there is no such thing as T for default priviledges that pg_dump understands based on 
-- https://github.com/adunstan/postgresql-dev/blob/master/src/bin/pg_dump/pg_dump.c#L11838
-- backup bad records just in case we need them again --&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;into&lt;/span&gt; zz_bad_pg_default_acl &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;FROM&lt;/span&gt; pg_default_acl  &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;WHERE&lt;/span&gt; defaclobjtype &lt;span class=&quot;syntax-OPERATOR&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;; 
&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;unknown&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;records&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD4&quot;&gt;DELETE&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;from&lt;/span&gt; pg_default_acl &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;WHERE&lt;/span&gt; defaclobjtype &lt;span class=&quot;syntax-OPERATOR&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;; 
&lt;/span&gt;&lt;/code&gt;
&lt;/pre&gt;
  

&lt;p&gt;If  anyone else has further input on this, I&#039;d be interested.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 31 Dec 2012 04:08:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/282-guid.html</guid>
    
</item>
<item>
    <title>Schema and search_path surprises</title>
    <link>http://www.postgresonline.com/journal/archives/279-Schema-and-search_path-surprises.html</link>
            <category>basics</category>
            <category>beginner</category>
            <category>postgis</category>
    
    <comments>http://www.postgresonline.com/journal/archives/279-Schema-and-search_path-surprises.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=279</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=279</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;This was an article we were meaning to write and got reminded by Szymon Guz latest &lt;a href=&quot;http://blog.endpoint.com/2012/11/postgresql-searchpath-behaviour.html&quot; target=&quot;_blank&quot;&gt;PostgreSQL search_path behavior&lt;/a&gt;.
The PostgreSQL &lt;em&gt;search_path&lt;/em&gt; variable allows you to control what order schemas are searched and which schemas do not require schema qualification to use tables/views/functions in the schema.  The &lt;em&gt;pg_catalog&lt;/em&gt; schema is one that never requires schema qualification even if you don&#039;t add it to your schema search_path.  Schemas are searched in the order they are listed
and when creating new objects (e.g. tables, views, function, types) that are not schema qualified, they are always created in the first schema of the search path. Any objects not in a schema listed in the search_path must be schema qualified.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/279-Schema-and-search_path-surprises.html#extended&quot;&gt;Continue reading &quot;Schema and search_path surprises&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 28 Nov 2012 23:52:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/279-guid.html</guid>
    <category>postgis</category>
<category>schema</category>
<category>search_path</category>

</item>
<item>
    <title>Table Inheritance and the tableoid</title>
    <link>http://www.postgresonline.com/journal/archives/240-Table-Inheritance-and-the-tableoid.html</link>
            <category>8.2</category>
            <category>8.3</category>
            <category>8.4</category>
            <category>9.0</category>
            <category>9.1</category>
            <category>9.2</category>
            <category>beginner</category>
            <category>q&amp;a</category>
    
    <comments>http://www.postgresonline.com/journal/archives/240-Table-Inheritance-and-the-tableoid.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=240</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=240</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;If I could name a number one feature I love most about PostgreSQL, it&#039;s the table inheritance feature which we described in &lt;a href=&quot;http://www.postgresonline.com/journal/archives/59-How-to-Inherit,-Unherit-and-Merge-Inherit.html&quot; target=&quot;_blank&quot;&gt;How to Inherit and Uninherit&lt;/a&gt;. A lot of people use it for table partitioning using &lt;a href=&quot;http://www.postgresonline.com/journal/archives/27-Reading-PgAdmin-Graphical-Explain-Plans.html&quot; target=&quot;_blank&quot;&gt;CONSTRAINT EXCLUSION&lt;/a&gt;.  Aside from that, in combination with PostgreSQL schema search_path (customizable by user and/or database) it makes for a very flexible abstraction tool.  For example, for many of our web apps that service many departments where each department/client wants to keep a high level of autonomy, we have a schema set aside for each 
that inherits from a master template schema.  Each department site uses a different set of accounts with the primary schema being that of the department/client so that they are hitting their own  tables. &lt;/p&gt;
&lt;p&gt;Inheritance allows us to keep data separate,do roll-up reports if we need to, use the same application front-end, and yet allows us the ability to add new columns in just one place (the master template schema).  It is more flexible than other approaches because for example we may have a city organization that need to share tables, like for example a system loaded list of funding source shared across the agency.  We can set aside these shared tables in a separate schema visible to all or have some have their own copy they can change if they don&#039;t want to use the shared one.&lt;/p&gt;

&lt;p&gt;Every once in a while, we find ourselves needing to query the whole hierarchy and needing to know which table the results of the query are coming from. To help
solve that issue, we employ the use of the system column &lt;b&gt;tableoid&lt;/b&gt; which all user tables have. The tableoid is the the object id of a table.  PostgreSQL has many system columns that you have to explicitly select
and can&#039;t be accessed with a SELECT * with the tableoid being one of them.  These are: tableoid, cmax,cmin, xmin,xmax,ctid which are all described in &lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/ddl-system-columns.html&quot; target=&quot;_blank&quot;&gt;System Columns&lt;/a&gt;.  The &lt;a href=&quot;http://www.postgresql.org/docs/9.1/static/ddl-inherit.html&quot; target=&quot;_blank&quot;&gt;PostgreSQL docs on inheritance&lt;/a&gt; have examples of using it, but we thought it worthwile to repeat the exercise since it&#039;s not that common knowledge and is unique enough feature of PostgreSQL that others coming from other relational databases, may miss the treat.  I&#039;ve often demonstrated
it to non-PostgreSQL users who use for example SQL Server or MySQL, and they literally fall out of their chair when I show the feature to them and its endless possibilities.&lt;/p&gt;   &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/240-Table-Inheritance-and-the-tableoid.html#extended&quot;&gt;Continue reading &quot;Table Inheritance and the tableoid&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 16 Jan 2012 05:52:54 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/240-guid.html</guid>
    
</item>
<item>
    <title>How big is my database and my other stuff</title>
    <link>http://www.postgresonline.com/journal/archives/233-How-big-is-my-database-and-my-other-stuff.html</link>
            <category>beginner</category>
            <category>q&amp;a</category>
    
    <comments>http://www.postgresonline.com/journal/archives/233-How-big-is-my-database-and-my-other-stuff.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=233</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=233</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In this day and age of clouds and what not, it is still important to keep tabs on your database growth to ensure it doesn&#039;t
outgrow your disks or so that you can be prepared when it does.  A common question that is asked is how big your database is or all your databases combined.
Luckily PostgreSQL has had for a long time functions to help you answer this easily.  In this little article,
I&#039;ll demonstrate how to answer these questions and more with some PostgreSQL built-in functions&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/233-How-big-is-my-database-and-my-other-stuff.html#extended&quot;&gt;Continue reading &quot;How big is my database and my other stuff&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 21 Nov 2011 01:59:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/233-guid.html</guid>
    <category>postgresql</category>

</item>
<item>
    <title>How to create an n-column table really fast</title>
    <link>http://www.postgresonline.com/journal/archives/230-How-to-create-an-n-column-table-really-fast.html</link>
            <category>8.4</category>
            <category>9.0</category>
            <category>9.1</category>
            <category>9.2</category>
            <category>beginner</category>
            <category>postgresql versions</category>
            <category>q&amp;a</category>
    
    <comments>http://www.postgresonline.com/journal/archives/230-How-to-create-an-n-column-table-really-fast.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=230</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=230</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;Ever have the need to create a holding table say spreadsheet data with say 100 columns. You need to create a table to hold this stuff.   Or perhaps you were feeling in a sadist mood and wanted to abuse your PostgreSQL database to see how many columns you can create in a table of a specific data type. 
Here is a quick script to do it:&lt;/p&gt;

&lt;code&gt;
&lt;pre&gt;&lt;span class=&quot;syntax0&quot;&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;8.4+&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;syntax&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;data_import(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;array_to_string&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-FUNCTION&quot;&gt;array_agg&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; i&lt;span class=&quot;syntax-OPERATOR&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;varchar(255)&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;generate_series&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;As&lt;/span&gt; i;

&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;9.0+&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;syntax&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;(string_agg&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;was&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;introduced&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;9.0)&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;data_import(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;string_agg&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; i&lt;span class=&quot;syntax-OPERATOR&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;varchar(255)&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;, &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;generate_series&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;As&lt;/span&gt; i;
&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;Both variants will return output that looks like this: &lt;/p&gt;
&lt;pre&gt;&lt;span class=&quot;syntax0&quot;&gt;&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;data_import&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;field1 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field2 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field3 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field4 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;
    ,field5 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field6 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field7 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;
    ,field8 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field9 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;,field10 &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;varchar&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Now if you want it to also execute because you are running it as part of an sql script, you could wrap it in an anonymous function.&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;&lt;span class=&quot;syntax0&quot;&gt; &lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;-wrap&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;an&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;anonymous&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;run&lt;/span&gt;
 &lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;requires&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;PostgreSQL&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;9.0+&lt;/span&gt;
DO language &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;plpgsql&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
$$
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;DECLARE&lt;/span&gt; var_sql &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;text&lt;/span&gt; :&lt;span class=&quot;syntax-OPERATOR&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;data_import(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
    &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;string_agg&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; i&lt;span class=&quot;syntax-OPERATOR&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;varchar(255)&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;, &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&#039;&lt;/span&gt;
    &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;generate_series&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;As&lt;/span&gt; i;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;BEGIN&lt;/span&gt;
    &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;EXECUTE&lt;/span&gt; var_sql;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;END&lt;/span&gt;;
$$ ;
&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;
 
    </content:encoded>

    <pubDate>Tue, 01 Nov 2011 22:31:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/230-guid.html</guid>
    <category>aggregates</category>
<category>array</category>
<category>array_agg</category>
<category>string_agg</category>

</item>
<item>
    <title>SQL Server to PostgreSQL: Converting table structure</title>
    <link>http://www.postgresonline.com/journal/archives/219-SQL-Server-to-PostgreSQL-Converting-table-structure.html</link>
            <category>basics</category>
            <category>beginner</category>
            <category>oracle</category>
            <category>plpgsql</category>
            <category>sql server</category>
    
    <comments>http://www.postgresonline.com/journal/archives/219-SQL-Server-to-PostgreSQL-Converting-table-structure.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=219</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=219</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;We&#039;ve been working on converting some of our SQL Server apps to PostgreSQL.   In this
article we&#039;ll describe some things to watch out for and provide a function we wrote to automate some of
the conversion.&lt;/p&gt;

&lt;p&gt;Although both databases are fairly ANSI-SQL compliant, there are still differences 
with their CREATE TABLE statements, data types, and how they handle other things that makes porting applications not so trivial. &lt;/p&gt;
&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/219-SQL-Server-to-PostgreSQL-Converting-table-structure.html#extended&quot;&gt;Continue reading &quot;SQL Server to PostgreSQL: Converting table structure&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 04 Sep 2011 00:33:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/219-guid.html</guid>
    <category>migration</category>
<category>oracle</category>
<category>regular expressions</category>
<category>sql server</category>

</item>
<item>
    <title>Querying table, view, column and function descriptions</title>
    <link>http://www.postgresonline.com/journal/archives/215-Querying-table,-view,-column-and-function-descriptions.html</link>
            <category>beginner</category>
            <category>postgis</category>
            <category>q&amp;a</category>
    
    <comments>http://www.postgresonline.com/journal/archives/215-Querying-table,-view,-column-and-function-descriptions.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=215</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=215</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;One of the biggest complaints about software and perhaps even more specifically FLOSS software is the lack of documentation. I&#039;m not talking about those 
small little dialogs we throw in our code that rarely see the light of day.  I&#039;m talking about stuff you throw in user docs or specifications and so forth
that an analyst or end-user reads.&lt;/p&gt;
&lt;p&gt;The main reasons for this lack of documentation is that while everyone seems to want documentation, few really want to pay for it, and it&#039;s time consuming to keep 
documentation in synch with what the software actually does.  Having documentation that is very inconsistent with the software is worse than not having any documentation at all. 
A good way to keep documentation up to date is to fold it into the process of developing and testing the software such that changes in software expose errors in the documentation and vice-versa
or that the act of changing the software corrects the documentation.&lt;/p&gt;
&lt;p&gt;Part of the way we try to do that on the PostGIS project is to require each function patch to include documentation.  We also try to make our documentation executable 
by auto-generating PostgreSQL help and 
some test suites  from the documentation.  For example the process of installing documentation-generated function and type descriptions 
in PostgreSQL catches inconsistencies between
the implementation and what we actually publish about how the functions work.  Even the image generator that builds most of the images in the manual is built with PostGIS as a core of it
so that when our build-bot is rebuilding the documentation it is exercising some PostGIS output functions.&lt;/p&gt;

&lt;p&gt;I can&#039;t tell you how many times I&#039;ve flagged changes in the current PostGIS 2.0 release
simply by trying to install the docbook generated PostgreSQL comment descriptions and PostgreSQL complains that the function signature no longer exists that the documentations says should be there. 
So then I go back and correct
the documentation or yell at the programmer if the documentation makes more sense than what they coded. On the other side,
its easy to catch what we neglected to document simply by scanning the functions in PostgreSQL and seeing which ones don&#039;t have descriptions.  &lt;/p&gt;

&lt;p&gt;Okay as far as databases goes, many a DB Programmer/Analyst has waltzed into a project only to be befuddled about the meanings of all these tables used by the application.
If you are like us, you don&#039;t even want to look at any database documentation that is not part of the definition of the database because you know 99% of the time it&#039;s so obsolete 
or was just a pipe dream of someone working in a vacuum
that its more useless than not having any 
documentation at all. It is nice to have nicely formatted documentation you can read separate from the code, 
but even sweeter if you can query the documentation just as easily as you can query the data. &lt;/p&gt; 
&lt;p&gt;A good way of having up to date documentation is to weave it in as part of the process of defining the structure.  For databases
this means using foreign keys, primary keys, and using the commenting features that most relational databases offer these days.  For example the databases we commonly work with,
PostgreSQL, SQL Server, MS Access, and even MySQL all allow you to provide descriptions for tables, table columns, and sometimes other objects such as functions and stored procs right in the database.  PostgreSQL even allows you to provide descriptions of columns in
views though that&#039;s a bit messier to do.  Sadly there isn&#039;t a consistent way of pulling these descriptions out of the database that will work for all of these.  Each has differently defined meta tables it stores these descriptions in.
For thise article, we&#039;ll demonstrate how to pull this information from PostgreSQL.&lt;/p&gt;

&lt;p&gt;PostgreSQL does offer many useful switches in psql for querying this data, but we&#039;ll focus our attention on pulling this data via SQL. It&#039;s much easier to incorporate this information
in auto-generated documentation with SQL  because you can have more control what you include and how to format it.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/215-Querying-table,-view,-column-and-function-descriptions.html#extended&quot;&gt;Continue reading &quot;Querying table, view, column and function descriptions&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 31 Jul 2011 05:07:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/215-guid.html</guid>
    <category>postgis documentation</category>

</item>
<item>
    <title>Navigating PostgreSQL 9.1 beta 1 with PgAdmin III 1.14.0 Beta 1</title>
    <link>http://www.postgresonline.com/journal/archives/206-Navigating-PostgreSQL-9.1-beta-1-with-PgAdmin-III-1.14.0-Beta-1.html</link>
            <category>9.1</category>
            <category>basics</category>
            <category>beginner</category>
            <category>pgadmin</category>
            <category>postgis</category>
    
    <comments>http://www.postgresonline.com/journal/archives/206-Navigating-PostgreSQL-9.1-beta-1-with-PgAdmin-III-1.14.0-Beta-1.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=206</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=206</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;We&#039;ve started to play with PostgreSQL 9.1beta and the PgAdmin III 1.14.0 Beta 1.  We&#039;ll briefly go over the cool gems 
found in PgAdmin III beta 1.  Most of the new features are for navigating the upcoming PostgreSQL 9.1.  Well first obstacle we ran into
was we can&#039;t get our favorite extension, PostGIS, to compile against PostgreSQL 9.1beta though it did with the alphas, so you won&#039;t be seeing any windows experimental builds until we resolve this issue.
Details of ticket here? &lt;a href=&quot;http://trac.osgeo.org/postgis/ticket/940&quot; target=&quot;_blank&quot;&gt;PostGIS 2.0 won&#039;t compile for  PostgreSQL 9.1 beta1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Despite that minor set back, we decided to push on and navigate the new features by using PgAdmin III 1.14.0 as our Tour Guide. Below is a list of new features you can experience
via PgAdmin III 1.14.0 Beta 1.  I&#039;m sure there are more we missed, but these are the ones that were most flashing.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/206-Navigating-PostgreSQL-9.1-beta-1-with-PgAdmin-III-1.14.0-Beta-1.html#extended&quot;&gt;Continue reading &quot;Navigating PostgreSQL 9.1 beta 1 with PgAdmin III 1.14.0 Beta 1&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 06 May 2011 23:45:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/206-guid.html</guid>
    <category>pgadmin</category>
<category>postgresql 9.1</category>
<category>sql med</category>

</item>
<item>
    <title>An Almost Idiot's Guide to Installing  PostGIS 1.5 on PostgreSQL 9.0 via Yum</title>
    <link>http://www.postgresonline.com/journal/archives/204-An-Almost-Idiots-Guide-to-Installing-PostGIS-1.5-on-PostgreSQL-9.0-via-Yum.html</link>
            <category>9.0</category>
            <category>basics</category>
            <category>beginner</category>
            <category>postgis</category>
            <category>postgresql versions</category>
            <category>yum</category>
    
    <comments>http://www.postgresonline.com/journal/archives/204-An-Almost-Idiots-Guide-to-Installing-PostGIS-1.5-on-PostgreSQL-9.0-via-Yum.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=204</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=204</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In the past I have always chosen to compile my own PostGIS  because the GEOS library that came with the regular PostgreSQL yum install, was a bit antiquated. 
This has changed, so this time around I figured I&#039;d give it a go at using the Yum repository 1.5.2 release of PostGIS available via &lt;a href=&quot;http://www.pgrpms.org/news-packagelist.php&quot; target=&quot;_blank&quot;&gt;Yum Package List&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;Before you can follow these directions, make sure you have your PostgreSQL 9.0 setup via our &lt;a href=&quot;http://www.postgresonline.com/journal/archives/203-postgresql90-yum.html&quot; target=&quot;_blank&quot;&gt;An almost idiot&#039;s guide to Install PostgreSQL 9.0 with Yum&lt;/a&gt;.&lt;/p&gt;

&lt;div style=&#039;background-color:yellow&#039;&gt;&lt;a href=&quot;http://www.amazon.com/PostGIS-Action-Regina-Obe/dp/1935182269?&amp;camp=213293&amp;linkCode=wey&amp;tag=postgisus-20&amp;creative=388373&quot; target=&quot;_blank&quot;&gt;PostGIS in Action&lt;/a&gt; has started shipping from Amazon and we already have 3 positive reviews.  We are hoping to write another book sometime soon, but haven&#039;t decided yet on the topic.  Will definitely have something to do with databases and probably a lot of PostgreSQL in it.&lt;/div&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/204-An-Almost-Idiots-Guide-to-Installing-PostGIS-1.5-on-PostgreSQL-9.0-via-Yum.html#extended&quot;&gt;Continue reading &quot;An Almost Idiot&#039;s Guide to Installing  PostGIS 1.5 on PostgreSQL 9.0 via Yum&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 21 Apr 2011 02:02:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/204-guid.html</guid>
    <category>postgis</category>
<category>postgresql 9.0</category>
<category>yum</category>

</item>
<item>
    <title>An almost idiot's guide to Install PostgreSQL 9.0 with Yum</title>
    <link>http://www.postgresonline.com/journal/archives/203-An-almost-idiots-guide-to-Install-PostgreSQL-9.0-with-Yum.html</link>
            <category>9.0</category>
            <category>basics</category>
            <category>beginner</category>
            <category>postgresql versions</category>
            <category>yum</category>
    
    <comments>http://www.postgresonline.com/journal/archives/203-An-almost-idiots-guide-to-Install-PostgreSQL-9.0-with-Yum.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=203</wfw:comment>

    <slash:comments>10</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=203</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In this exercise, we&#039;ll go thru installing PostgreSQL 9.0 on a Cent OS 5.5 32-bit box. This I&#039;m testing on a GoGrid Cloud server so I can do parallel benchmarks between my windows GoGrid
and Linux GoGrid server.&lt;/p&gt;

&lt;h4&gt;Upgrading from PostgreSQL 8.* to PostgreSQL 9.0&lt;/h4&gt;
&lt;p&gt;If you are upgrading from a PostgreSQL 8.4 to PostgreSQL 9.0, please refer to Devrim&#039;s article: 
&lt;a href=&quot;http://people.planetpostgresql.org/devrim/index.php?/archives/50-Upgrading-from-8.4-to-9.0-on-Fedora-Red-Hat-CentOS-using-RPMs.html&quot; target=&quot;_blank&quot;&gt;Upgrading from 8.4 to 9.0 on Fedora / Red Hat / CentOS using RPMs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the rest of this article, we&#039;ll go over configuring your yum to use the PostgreSQL PGDG Yum repository managed by Devrim Gunduz, which has the latest and greatest of 
9.0 as well as the 9.1 latest development release. We&#039;ll also demonstrate how to have two instances of PostgreSQL running so you can experiment with the new features of
PostgreSQL 9.1 while reminiscing about the soon to be old-hat features of PostgreSQL 9.0.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/203-An-almost-idiots-guide-to-Install-PostgreSQL-9.0-with-Yum.html#extended&quot;&gt;Continue reading &quot;An almost idiot&#039;s guide to Install PostgreSQL 9.0 with Yum&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 18 Apr 2011 04:32:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/203-guid.html</guid>
    <category>yum cloud</category>

</item>
<item>
    <title>SQL Server 64-bit Linked Server woes</title>
    <link>http://www.postgresonline.com/journal/archives/196-SQL-Server-64-bit-Linked-Server-woes.html</link>
            <category>9.0</category>
            <category>basics</category>
            <category>beginner</category>
            <category>sql server</category>
    
    <comments>http://www.postgresonline.com/journal/archives/196-SQL-Server-64-bit-Linked-Server-woes.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=196</wfw:comment>

    <slash:comments>12</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=196</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;We were setting up another SQL Server 2005 64-bit where we needed a linked server connection to our PostgreSQL 9.0 server.  This is something we&#039;ve done before so not new and something we documented in  
&lt;a href=&quot;http://www.postgresonline.com/journal/archives/46-Setting-up-PostgreSQL-as-a-Linked-Server-in-Microsoft-SQL-Server-64-bit.html&quot; target=&quot;_blank&quot;&gt;Setting up PostgreSQL as a Linked Server in Microsoft SQL Server 64-bit&lt;/a&gt;.
What was different this time is that we decided to use the latest version of the new PostgreSQL 64-bit drivers now available main PostgreSQL site &lt;a href=&quot;http://www.postgresql.org/ftp/odbc/versions/msi/&quot; target=&quot;_blank&quot;&gt;http://www.postgresql.org/ftp/odbc/versions/msi/&lt;/a&gt;. 
Sadly these did not work for us.  They seemed to work fine in our MS Access 2010 64-bit install, but when used via SQL Server, SQL Server would choke with a message:&lt;/p&gt;

&lt;span style=&quot;color:red&quot;&gt;Msg 7350, Level 16, State 2, Line 1&lt;br /&gt;Cannot get the column information from OLE DB provider &quot;MSDASQL&quot;&lt;/span&gt; 
&lt;p&gt;If you tried to do a query with them.  You can however see all the tables via the linked server tab.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/196-SQL-Server-64-bit-Linked-Server-woes.html#extended&quot;&gt;Continue reading &quot;SQL Server 64-bit Linked Server woes&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 21 Feb 2011 19:10:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/196-guid.html</guid>
    <category>sql server</category>

</item>
<item>
    <title>Conditional Uniqueness with Partial Indexes</title>
    <link>http://www.postgresonline.com/journal/archives/195-Conditional-Uniqueness-with-Partial-Indexes.html</link>
            <category>8.2</category>
            <category>8.3</category>
            <category>8.4</category>
            <category>9.0</category>
            <category>9.1</category>
            <category>beginner</category>
            <category>postgresql versions</category>
            <category>q&amp;a</category>
            <category>sql server</category>
    
    <comments>http://www.postgresonline.com/journal/archives/195-Conditional-Uniqueness-with-Partial-Indexes.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=195</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=195</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;b&gt;Question&lt;/b&gt;&lt;p&gt;You have a system of products and categories and you want a product to be allowed to be in multiple categories, but you want a product to only be allowed to be in one main category.
How do you enforce this rule in the database?&lt;/p&gt;

&lt;p&gt;Some people will say -- why can&#039;t you just deal with this in your application logic. Our general reason is that much of our updating doesn&#039;t happen at our application level. We like enforcing rules at the database
level because it saves us from ourselves. We are in the business of massaging data.  For this particular kind of example we wanted to make sure the database would provide us a nice safety net so that 
we wouldn&#039;t accidentally assign a product in two main categories.&lt;/p&gt;

&lt;b&gt;Answer&lt;/b&gt;
&lt;p&gt;There are two approaches we thought of.  One is the obvious have a primary category column and a bridge table that has secondary categories.  That is an ugly solution because when you do a query you have to do a union
and always treat the secondary categories as different from the main.  For most use-cases we don&#039;t usually care about distinguisihing primary from secondary category.&lt;/p&gt;

&lt;p&gt;The solution we finally settled on was to have one bridge table with a boolean field for if its the main category.  We enforce the only one main category requirement using a partial index.  Now not all databases support partial indexes
This is one major value of using PostgreSQL that you have so many more options for implementing logic.  &lt;/p&gt;

&lt;div style=&quot;background-color:yellow&quot;&gt;As some people noted in the comments and the reddit entry.  SQL Server 2008 has a similar feature called Filtered Indexes.  Though PostgreSQL has had partial indexes for as far back as I can remember.  This brings up an interesting point which I have observed -- if you were using PostgreSQL before, you would already know how to use the Filtered Indexes, Multi row inserts introduced in SQL Server 2008, and the SEQUENCES feature coming in SQL Server 2010. So we should all use PostgreSQL, because it teaches us how to use the newer versions of SQL Server before they come out. :)&lt;/div&gt;

&lt;p&gt;So how does the partial index solution look:  NOTE for simplicity, we are leaving out all the complimentary tables and the foreign key constraints that we also have in place.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax0&quot;&gt;&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;TABLE&lt;/span&gt; products_categories
&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;
  category_id &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;integer&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NULL&lt;/span&gt;,
  product_id &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;integer&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NULL&lt;/span&gt;,
  main boolean &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;DEFAULT&lt;/span&gt; false,
  orderby &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;integer&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NOT&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;NULL&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;DEFAULT&lt;/span&gt; &lt;span class=&quot;syntax-DIGIT&quot;&gt;0&lt;/span&gt;,
  &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;CONSTRAINT&lt;/span&gt; products_categories_pkey &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;PRIMARY&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;KEY&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;category_id, product_id&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;;

&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;UNIQUE&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;INDEX&lt;/span&gt; idx_products_categories_primary
  &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;ON&lt;/span&gt; products_categories
  USING btree
  &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;product_id&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;WHERE&lt;/span&gt; main &lt;span class=&quot;syntax-OPERATOR&quot;&gt;=&lt;/span&gt; true;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Testing it out.  It saves us and gives us a nice informative message to boot.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax0&quot;&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;we&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;our&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;safety&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;net&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;syntax-FUNCTION&quot;&gt;products_categories&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;category_id, product_id, main&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;syntax-KEYWORD1&quot;&gt;VALUES&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;2&lt;/span&gt;,true&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;3&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;2&lt;/span&gt;,false&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;3&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;3&lt;/span&gt;,true&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;, &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;4&lt;/span&gt;,&lt;span class=&quot;syntax-DIGIT&quot;&gt;2&lt;/span&gt;,true&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;;


&lt;span class=&quot;syntax-COMMENT1&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;gives&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;us&lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;syntax-COMMENT1&quot;&gt;error&lt;/span&gt;
&lt;span class=&quot;syntax-LABEL&quot;&gt;ERROR&lt;/span&gt;&lt;span class=&quot;syntax-LABEL&quot;&gt;:&lt;/span&gt;  duplicate &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;key&lt;/span&gt; value violates &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;unique&lt;/span&gt; &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;constraint&lt;/span&gt; &lt;span class=&quot;syntax-LITERAL1&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;idx_products_categories_primary&lt;/span&gt;&lt;span class=&quot;syntax-LITERAL1&quot;&gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;syntax-LABEL&quot;&gt;DETAIL&lt;/span&gt;&lt;span class=&quot;syntax-LABEL&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;Key&lt;/span&gt; &lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;product_id&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-DIGIT&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-OPERATOR&quot;&gt;)&lt;/span&gt; already &lt;span class=&quot;syntax-KEYWORD1&quot;&gt;exists&lt;/span&gt;.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Sat, 19 Feb 2011 23:12:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/195-guid.html</guid>
    
</item>
<item>
    <title>Reverse String Aggregation: Explode concatenated data into separate rows In PostgreSQL, SQL Server and MySQL</title>
    <link>http://www.postgresonline.com/journal/archives/193-Reverse-String-Aggregation-Explode-concatenated-data-into-separate-rows-In-PostgreSQL,-SQL-Server-and-MySQL.html</link>
            <category>beginner</category>
            <category>mysql</category>
            <category>postgresql versions</category>
            <category>q&amp;a</category>
            <category>sql server</category>
    
    <comments>http://www.postgresonline.com/journal/archives/193-Reverse-String-Aggregation-Explode-concatenated-data-into-separate-rows-In-PostgreSQL,-SQL-Server-and-MySQL.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=193</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=193</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In our last article we talked about &lt;a href=&quot;http://www.postgresonline.com/journal/archives/191-stringagg.html&quot; target=&quot;_blank&quot;&gt;String Aggregation implementing in PostgreSQL, SQL Server, and MySQL&lt;/a&gt;.  This task is one that makes purist relational database programmers
a bit squeamish.  In this article we&#039;ll talk about the reverse of that, how do you deal with data that someone hands you delimeted in a single field and that you are asked to explode or re-sort based on some  lookup table.&lt;/p&gt;

&lt;p&gt;What are the benefits of having a structure such as? : &lt;pre&gt;&lt;code&gt;p_name |           activities
--------+--------------------------------
 Dopey  | Tumbling
 Humpty | Cracking;Seating;Tumbling
 Jack   | Fishing;Hiking;Skiing
 Jill   | Bear Hunting;Hiking
&lt;/code&gt;&lt;/pre&gt;Well for the casual programmer or simple text file database that knows nothing about JOINS and so forth, it makes it simple to pull a list of people who like Tumbling.
You simply do a WHERE &#039;;&#039; || activities || &#039;;&#039; LIKE &#039;%;Tumbling;%&#039;.  It&#039;s great for security too because you can determine security with a simple like check and also list all the security groups a member belongs in without doing anything.  
Quite easy for even the least data-skilled of programmers to work with because most procedural languages have a split function that can easily parse these into an array useful for stuffing into drop down lists and so forth. As a consultant of semi-techie people
I&#039;m often torn by the dilemma of &quot;What is the way I would program for myself vs. the way that provides the most autonomy to the client&quot;.  By that I mean
for example I try to avoid heavy-weight things like Wizards that add additional bloated dependencies or slow the speed down of an application. These bloated dependencies may provide ease to the client but make my debugging life harder. So I weight the options
and figure out which way works now and also provides me an easy escape route should things like speed or complexity become more of an issue.&lt;/p&gt;
&lt;p&gt;This brings us to the topic of, what is wrong with this model?  It can be slow because the LIKE condition you have can&#039;t easily take advantage of an index unless using a full text index so not ideal where this is the primary filtering factor.  It&#039;s also prone to pollution because
you can&#039;t easily validate that the values in the field are in your valid set of lookups or if your lookup changes, the text can be forced to change with a CASCADE UPDATE/DELETE RULE etc.  In cases where this is of minor consequence
which is many if referential integrity is not high on your list of requirements, this design is not bad.  It might make a purist throw up but oh well there is always dramamine to fall back on.  As long as you have done your cost benefit analysis, I don&#039;t think there should be any shame of following this
less than respected route.&lt;/p&gt;
&lt;p&gt;While you may despise this model, it has its place and it&#039;s a fact of life that one day someone will hand it to you and you may need to flip it around a bit.  We shall demonstrate how to do that in this article.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/193-Reverse-String-Aggregation-Explode-concatenated-data-into-separate-rows-In-PostgreSQL,-SQL-Server-and-MySQL.html#extended&quot;&gt;Continue reading &quot;Reverse String Aggregation: Explode concatenated data into separate rows In PostgreSQL, SQL Server and MySQL&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 18 Jan 2011 18:50:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/193-guid.html</guid>
    
</item>
<item>
    <title>PostgreSQL 9.0 pg_dump, pg_dumpall, pg_restore cheatsheet overview</title>
    <link>http://www.postgresonline.com/journal/archives/186-PostgreSQL-9.0-pg_dump,-pg_dumpall,-pg_restore-cheatsheet-overview.html</link>
            <category>9.0</category>
            <category>beginner</category>
            <category>special feature</category>
    
    <comments>http://www.postgresonline.com/journal/archives/186-PostgreSQL-9.0-pg_dump,-pg_dumpall,-pg_restore-cheatsheet-overview.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=186</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>http://www.postgresonline.com/journal/rss.php?version=2.0&amp;type=comments&amp;cid=186</wfw:commentRss>
    

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;Backup and Restore is probably the most important thing to know how to do when you have a database with data you care about.&lt;/p&gt;

&lt;p&gt;The utilities in PostgreSQL that accomplish these tasks are pg_restore, pg_dump, pg_dumpall, and for restore of plain text dumps - psql.  &lt;/p&gt;
&lt;p&gt;A lot of the switches used by pg_dump, pg_restore, pg_dumpall are common to all three.  You use pg_dump to do backups of a single database or select database objects and pg_restore to restore it either to another database or to recover portions of a database.  You use pg_dumpall to dump all your databases in plain text format.  &lt;/p&gt;

&lt;p&gt;Rather than trying to keep track of which switch works with which, we decided to combine all into a single cheat sheet with a column denoting which utility the switch is supported in.
Pretty much all the text is compiled from the --help switch of each.&lt;/p&gt;
&lt;P&gt;We created a similar &lt;a href=&quot;http://www.postgresonline.com/journal/archives/63-PostgreSQL-8.3-Pg_dump-Pg_Restore-Cheatsheet-Overview.html&quot; target=&quot;_blank&quot;&gt;Backup and Restore cheatsheet for PostgreSQL 8.3&lt;/a&gt; and since then some new features have been added such as the jobs parallel restore feature in 8.4.  We have now created an updated sheet to comprise all features present in PostgreSQL 9.0 packaged pg_dump, pg_restore, pg_dumpall command line utilities.
&lt;/P&gt;
&lt;P&gt;PDF Portrait version 8.5 x 11&quot; of this cheatsheet is available at &lt;a href=&quot;/special_feature.php?sf_name=postgresql90_pg_dumprestore_cheatsheet&amp;outputformat=pdf&quot; target=&quot;_blank&quot;&gt;PostgreSQL 9.0 Dump Restore 8.5 x 11&lt;/a&gt; and also available in
&lt;a href=&quot;/special_feature.php?sf_name=postgresql90_pg_dumprestore_cheatsheet&amp;outputformat=a4pdf&quot; target=&quot;_blank&quot;&gt;PDF A4 format&lt;/a&gt; and &lt;a href=&quot;/special_feature.php?sf_name=postgresql90_pg_dumprestore_cheatsheet&amp;outputformat=html&quot; target=_blank&gt;HTML&lt;/a&gt;.
&lt;/P&gt;

&lt;p&gt;As usual please let us know if you find any errors or omissions and we&#039;ll be happy to correct.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 21 Nov 2010 20:35:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/186-guid.html</guid>
    <category>backup</category>
<category>pg_dump</category>
<category>pg_restore</category>
<category>pgadmin</category>
<category>postgresql 9.0</category>
<category>restore</category>

</item>

</channel>
</rss>