<?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 - application development</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>Fri, 26 Aug 2011 23:09:37 GMT</pubDate>

    <image>
        <url>http://www.postgresonline.com/journal/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Postgres OnLine Journal - application development - 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>PostGIS as a graphical engine</title>
    <link>http://www.postgresonline.com/journal/archives/218-PostGIS-as-a-graphical-engine.html</link>
            <category>application development</category>
            <category>gis</category>
            <category>postgis</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/218-PostGIS-as-a-graphical-engine.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=218</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;A while back in &lt;a href=&quot;http://www.postgresonline.com/journal/archives/208-New-Additions-and-Promotions-in-PostGIS-Development-Team.html&quot; target=&quot;_blank&quot;&gt;New Additions and Promotions in PostGIS Development Team&lt;/a&gt;, I mentioned that the new addition to our team Bborie Park was working on image output functions for raster support, among other things.  His last addition was ST_AsRaster which allows a PostGIS geometry to cross the line to the raster world, all in the database.  This new addition almost completes the basic cycle of making PostGIS not only a spatial analytical tool, but also a rendering engine.&lt;/p&gt;

&lt;p&gt;To test out these new functions, I whipped up a quick ASP.NET/JQuery app as described in &lt;a href=&quot;http://www.bostongis.com/blog/index.php?/archives/174-Minimalist-Web-based-ASP.NET-PostGIS-2.0-Spatial-GeometryRaster-Viewer.html&quot; target=&quot;_blank&quot;&gt;Minimalist Web-based ASP.NET PostGIS 2.0 Spatial Geometry/Raster Viewer&lt;/a&gt;, and Bborie followed up with the PHP version which you can download from &lt;a href=&quot;http://www.postgis.us/downloads/postgis_webviewer_php.zip&quot; target=&quot;_blank&quot;&gt;http://www.postgis.us/downloads/postgis_webviewer_php.zip&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is still much room for improvement, e.g. intersection of 2 rasters, faster response, etc,  but I can see all the lights flickering and the connections coming together like a self-orchestrating organism.  From chaos comes order.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 26 Aug 2011 18:50:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/218-guid.html</guid>
    <category>postgis raster viewer</category>

</item>
<item>
    <title>Explain Plans PostgreSQL 9.0 - Part 2: JSON and JQuery Plan Viewer</title>
    <link>http://www.postgresonline.com/journal/archives/174-Explain-Plans-PostgreSQL-9.0-Part-2-JSON-and-JQuery-Plan-Viewer.html</link>
            <category>9.0</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>jquery</category>
            <category>pgadmin</category>
            <category>postgresql versions</category>
    
    <comments>http://www.postgresonline.com/journal/archives/174-Explain-Plans-PostgreSQL-9.0-Part-2-JSON-and-JQuery-Plan-Viewer.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=174</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In &lt;a href=&quot;http://www.postgresonline.com/journal/archives/171-pgexplain90formats_part1.html&quot; target=&quot;_blank&quot;&gt;part 1 of this series&lt;/a&gt; on PostgreSQL 9.0 planner outputs, we demonstrated how to render explain plans in YAML, JSON, and XML using the new explain features in PostgreSQL 9.0. In this second part,
we&#039;ll demonstrate how to build a user interface that allows you input a JSON formatted explain plan and have it render into a printable, navigateable display using JQuery, javascript and a little bit of HTML coding.  
In part 3 we&#039;ll do something similar using XML and XSLT programming.
&lt;/p&gt;
&lt;p&gt;For those who aren&#039;t familiar with JQuery, it is an MIT licensed javascript library that is fairly light weight and allows you to inspect and change html elements with fairly intuitive syntax, has some nice ajax methods and tools for converting xml/json to native objects that can be manipulated. 
You can check it out at &lt;a href=&quot;http://jquery.com/&quot; target=&quot;_blank&quot;&gt;JQUERY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We are not experts in JQuery, but from what we have used of it, we really like it and the fact the base package is MIT licensed, fairly light weight and lots of plugins available for it are real pluses.&lt;/p&gt;


&lt;p&gt;The most difficult thing I think most people find about reading explain plans is that they are upside down; it starts with a conclusion and backtracks how to arrive at it.  Humans by nature think about planning steps from start to finish.
In order to make an explain plan understandable to mere mortals, we generally display them upside down or having the child-nodes shown left most.  We shall follow that approach.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/174-Explain-Plans-PostgreSQL-9.0-Part-2-JSON-and-JQuery-Plan-Viewer.html#extended&quot;&gt;Continue reading &quot;Explain Plans PostgreSQL 9.0 - Part 2: JSON and JQuery Plan Viewer&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 26 Aug 2010 04:13:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/174-guid.html</guid>
    <category>explain plan</category>
<category>imagemagick</category>
<category>jquery</category>
<category>json</category>
<category>pgadmin</category>
<category>postgresql 9.0</category>

</item>
<item>
    <title>Loading and Processing GPX XML files  using PostgreSQL</title>
    <link>http://www.postgresonline.com/journal/archives/116-Loading-and-Processing-GPX-XML-files-using-PostgreSQL.html</link>
            <category>8.3</category>
            <category>8.4</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>oracle</category>
            <category>postgresql versions</category>
    
    <comments>http://www.postgresonline.com/journal/archives/116-Loading-and-Processing-GPX-XML-files-using-PostgreSQL.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=116</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;http://www.spatialdbadvisor.com/biography&quot; target=&quot;_blank&quot;&gt;Simon Greener&lt;/a&gt;, wrote an article on &lt;a href=&quot;http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/119/loading-and-processing-gpx-11-files-using-oracle-xmldb&quot; target=&quot;_blank&quot;&gt;how to load GPX xml files into Oracle XMLDB&lt;/a&gt;.  That
got me thinking that I haven&#039;t really explored all the XML features that PostgreSQL has to offer
and to some extent I&#039;ve been reticent about XML processed in any database for that matter. &lt;/p&gt;
&lt;p&gt;In this article we shall attempt to perform the same feats that Simon did, but with PostgreSQL instead of
Oracle XMLDB.  Note while we are demonstrating this with a GPX file, the same XPath approach can be used to process any XML file.
&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/116-Loading-and-Processing-GPX-XML-files-using-PostgreSQL.html#extended&quot;&gt;Continue reading &quot;Loading and Processing GPX XML files  using PostgreSQL&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 29 Apr 2009 00:28:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/116-guid.html</guid>
    
</item>
<item>
    <title>Fusion Charts and PostgreSQL Part 3: PHP Dashboard</title>
    <link>http://www.postgresonline.com/journal/archives/95-Fusion-Charts-and-PostgreSQL-Part-3-PHP-Dashboard.html</link>
            <category>8.2</category>
            <category>8.3</category>
            <category>8.4</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>usda</category>
    
    <comments>http://www.postgresonline.com/journal/archives/95-Fusion-Charts-and-PostgreSQL-Part-3-PHP-Dashboard.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=95</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
     &lt;p&gt;In the first part of this series &lt;a href=&quot;http://www.postgresonline.com/journal/archives/88-Fusion-Charts-and-PostgreSQL-Part-1-Database-Analysis-of-USDA-DB.html&quot;&gt;Fusion Charts and PostgreSQL Part 1: Database Analysis of USDA DB&lt;/a&gt; in our November/December 2008 issue, we did
some back-seat analysis of a database we had never seen before and formulated some thoughts of things that would be useful to
see in a dashboard as well as starting to develop some views to support our Dashboard. In the second part of our Fusion Charts series, 
we covered creating a &lt;a href=&quot;http://www.postgresonline.com/journal/archives/92-Fusion-Charts-and-PostgreSQL-Part-2-ASP.NET-Dashboard.html&quot; target=&quot;_blank&quot;&gt;Dashboard application in ASP.NET that demonstrated both VB.NET and C# variants&lt;/a&gt; using the database we loaded and prepped in Part 1.
&lt;/p&gt;
&lt;p&gt;In this part three of our series, we shall conclude by demonstrating the same application we did in ASP.NET in PHP.&lt;/p&gt;

&lt;P&gt;We are going to create a simple dashboard that has the following features: &lt;/P&gt;

&lt;OL&gt;&lt;LI&gt;A drop-down list to allow the user to pick the kind of chart to display the data in (Bar, column, funnel etc)&lt;/LI&gt;
	&lt;LI&gt;A drop-down list that allows the user to pick the metric to explore -- e.g. Cholestrol, Vitamin K, Caffeine etc.&lt;/LI&gt;
	&lt;LI&gt;2 charts -- one chart showing the top 5 food groups for our metric and another showing the top 5 foods for our metric&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Our final product will look like this: &lt;/P&gt;
&lt;img src=&quot;/images/journal/fcharts_dashboard.png&quot; alt=&quot;Fusion Charts Dashboard&quot; /&gt;

&lt;p&gt;You can see the app in action - &lt;a href=&quot;/demos/FCharts/view_charts.php&quot; target=&quot;_blank&quot;&gt;USDA Food Stats&lt;/a&gt; and discover some interesting things about the food you eat or were considering eating.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/95-Fusion-Charts-and-PostgreSQL-Part-3-PHP-Dashboard.html#extended&quot;&gt;Continue reading &quot;Fusion Charts and PostgreSQL Part 3: PHP Dashboard&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 03 Jan 2009 15:19:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/95-guid.html</guid>
    
</item>
<item>
    <title>Fusion Charts and PostgreSQL Part 2: ASP.NET Dashboard</title>
    <link>http://www.postgresonline.com/journal/archives/92-Fusion-Charts-and-PostgreSQL-Part-2-ASP.NET-Dashboard.html</link>
            <category>8.2</category>
            <category>8.3</category>
            <category>8.4</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>mono .NET</category>
            <category>usda</category>
    
    <comments>http://www.postgresonline.com/journal/archives/92-Fusion-Charts-and-PostgreSQL-Part-2-ASP.NET-Dashboard.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=92</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In the first part of this series &lt;a href=&quot;http://www.postgresonline.com/journal/archives/88-Fusion-Charts-and-PostgreSQL-Part-1-Database-Analysis-USDA-DB.html&quot;&gt;Fusion Charts and PostgreSQL Part 1: Database Analysis of USDA DB&lt;/a&gt; in our November/December 2008 issue, we did
some back-seat analysis of a database we had never seen before and formulated some thoughts of things that would be useful to
see in a dashboard as well as starting to develop some views to support our Dashboard.
&lt;/p&gt;
&lt;p&gt;In this part, we start the fun off by building an ASP.NET app in both VB and C#. In the next part of
this series, we shall perform the same feat with PHP.&lt;/p&gt;

&lt;P&gt;We are going to create a simple dashboard that has the following features: &lt;/P&gt;
&lt;OL&gt;&lt;LI&gt;A drop downlist to allow the user to pick the kind of chart to display the data in (Bar, column, funnel etc)&lt;/LI&gt;
	&lt;LI&gt;A drop downlist that allows the user to pick the metric to explore -- e.g. Cholestrol, Vitamin K, Caffeine etc.&lt;/LI&gt;
	&lt;LI&gt;2 charts -- one chart showing the top 5 food groups for our metric and another showing the top 5 foods for our metric&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Our final product will look like this: &lt;/P&gt;
&lt;img src=&quot;/images/journal/fcharts_dashboard.png&quot; alt=&quot;Fusion Charts Dashboard&quot; /&gt;

&lt;p&gt;You can see the app in action - &lt;a href=&quot;/demos/FCharts/ViewChartsCS.aspx&quot; target=&quot;_blank&quot;&gt;USDA Food Stats&lt;/a&gt; and discover some interesting things about the food you eat or were considering eating.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/92-Fusion-Charts-and-PostgreSQL-Part-2-ASP.NET-Dashboard.html#extended&quot;&gt;Continue reading &quot;Fusion Charts and PostgreSQL Part 2: ASP.NET Dashboard&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Fri, 19 Dec 2008 17:19:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/92-guid.html</guid>
    
</item>
<item>
    <title>Fusion Charts and PostgreSQL Part 1: Database Analysis of USDA DB</title>
    <link>http://www.postgresonline.com/journal/archives/88-Fusion-Charts-and-PostgreSQL-Part-1-Database-Analysis-of-USDA-DB.html</link>
            <category>application development</category>
            <category>beginner</category>
            <category>demo dbs</category>
            <category>oobase</category>
            <category>usda</category>
    
    <comments>http://www.postgresonline.com/journal/archives/88-Fusion-Charts-and-PostgreSQL-Part-1-Database-Analysis-of-USDA-DB.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=88</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;p&gt;In our Product Showcase section of this issue, we introduced Fusion Charts which is a flash-based
charting product that makes beautiful flash charts.  It comes in both a free and a non-free more bells and whistles
version. &lt;/p&gt;

&lt;p&gt;In this 3-part series article we shall demonstrate using this with a PostgreSQL database, building a simple dashboard
with ASP.NET and PHP.  We shall demonstrate both C# and VB.NET both using the PostgreSQL NPGSQL driver.&lt;/p&gt;

&lt;p&gt;For this first part we shall simply load the database, do a quick analysis of what we&#039;ve got to report on and create some views to help
us with our PHP and ASP.NET apps that will follow in parts 2 and 3.&lt;/p&gt;

&lt;p&gt;We will be testing this on 8.3, but since the database is an old one, it should work just fine on older versions of 
PostgreSQL.  We&#039;ll try to refrain from using new features of PostgreSQL.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/88-Fusion-Charts-and-PostgreSQL-Part-1-Database-Analysis-of-USDA-DB.html#extended&quot;&gt;Continue reading &quot;Fusion Charts and PostgreSQL Part 1: Database Analysis of USDA DB&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 16 Dec 2008 14:33:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/88-guid.html</guid>
    
</item>
<item>
    <title>REST in PostgreSQL Part 3 B - The REST Client in Adobe Flex 3 with Paging</title>
    <link>http://www.postgresonline.com/journal/archives/52-REST-in-PostgreSQL-Part-3-B-The-REST-Client-in-Adobe-Flex-3-with-Paging.html</link>
            <category>adobe flex</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>pagila</category>
            <category>tsearch</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/52-REST-in-PostgreSQL-Part-3-B-The-REST-Client-in-Adobe-Flex-3-with-Paging.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=52</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;In prior articles of this series, we covered the following:
&lt;OL&gt;&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL---The-PreQuel.html&quot; target=_blank&gt;Showcasing REST in PostgreSQL - The PreQuel&lt;/a&gt; we went over what REST is and isn&#039;t&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html&quot; target=_blank&gt;REST in PostgreSQL Part 1 - The DB components&lt;/a&gt; we loaded the Pagila database and created a db plpgsql search function to support our rest server service&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html&quot; target=_blank&gt;REST in PostgreSQL Part 2 A - The REST Server service with ASP.NET&lt;/a&gt; we demonstrated a REST web service using Mono.NET, MS.NET both in C#, VB.Net/Monobasic&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/42-REST-in-PostgreSQL-Part-2-B-The-REST-Server-service-with-PHP-5.html&quot; target=_blank&gt;REST in PostgreSQL Part 2 B - The REST Server service with PHP 5&lt;/a&gt; we demonstrated a REST web service using PHP 5&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/49-REST-in-PostgreSQL-Part-3-A---Simple-REST-Client-in-Adobe-Flex-3.html&quot; target=_blank&gt;REST in PostgreSQL Part 3 A - Simple REST Client in Adobe Flex 3&lt;/a&gt; we demonstrated a basic REST client in Adobe Flex&lt;/LI&gt;
&lt;/OL&gt;
&lt;/P&gt;

&lt;P&gt;In this article we shall continue where we left off by adding paging functionality to our Adobe Flex REST grid client.&lt;/P&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/52-REST-in-PostgreSQL-Part-3-B-The-REST-Client-in-Adobe-Flex-3-with-Paging.html#extended&quot;&gt;Continue reading &quot;REST in PostgreSQL Part 3 B - The REST Client in Adobe Flex 3 with Paging&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Mon, 19 May 2008 15:06:23 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/52-guid.html</guid>
    
</item>
<item>
    <title>REST in PostgreSQL Part 3 A - Simple REST Client in Adobe Flex 3</title>
    <link>http://www.postgresonline.com/journal/archives/49-REST-in-PostgreSQL-Part-3-A-Simple-REST-Client-in-Adobe-Flex-3.html</link>
            <category>adobe flex</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>mono .NET</category>
            <category>pagila</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/49-REST-in-PostgreSQL-Part-3-A-Simple-REST-Client-in-Adobe-Flex-3.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=49</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;In prior articles of this series, we covered the following:
&lt;OL&gt;&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL---The-PreQuel.html&quot; target=_blank&gt;Showcasing REST in PostgreSQL - The PreQuel&lt;/a&gt; we went over what REST is and isn&#039;t&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html&quot; target=_blank&gt;REST in PostgreSQL Part 1 - The DB components&lt;/a&gt; we loaded the Pagila database and created a db plpgsql search function to support our rest server service&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html&quot; target=_blank&gt;REST in PostgreSQL Part 2 A - The REST Server service with ASP.NET&lt;/a&gt; we demonstrated a REST web service using Mono.NET, MS.NET both in C#, VB.Net/Monobasic&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/42-REST-in-PostgreSQL-Part-2-B-The-REST-Server-service-with-PHP-5.html&quot; target=_blank&gt;REST in PostgreSQL Part 2 B - The REST Server service with PHP 5&lt;/a&gt; we demonstrated a REST web service using PHP 5&lt;/LI&gt;
&lt;/OL&gt;
&lt;/P&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/49-REST-in-PostgreSQL-Part-3-A-Simple-REST-Client-in-Adobe-Flex-3.html#extended&quot;&gt;Continue reading &quot;REST in PostgreSQL Part 3 A - Simple REST Client in Adobe Flex 3&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 07 May 2008 15:45:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/49-guid.html</guid>
    
</item>
<item>
    <title>REST in PostgreSQL Part 2 B - The REST Server service with PHP 5</title>
    <link>http://www.postgresonline.com/journal/archives/42-REST-in-PostgreSQL-Part-2-B-The-REST-Server-service-with-PHP-5.html</link>
            <category>adodb</category>
            <category>application development</category>
            <category>intermediate</category>
            <category>pagila</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/42-REST-in-PostgreSQL-Part-2-B-The-REST-Server-service-with-PHP-5.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=42</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;This is a continuation of our REST series.  The following topics have already been covered &lt;/P&gt;
&lt;OL&gt;&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL---The-PreQuel.html&quot; target=_blank&gt;Showcasing REST in PostgreSQL - The PreQuel&lt;/a&gt; we went over what REST is and isn&#039;t&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html&quot; target=_blank&gt;REST in PostgreSQL Part 1 - The DB components&lt;/a&gt; we loaded the Pagila database and created a db plpgsql search function that spits out XML to support our rest server service&lt;/LI&gt;
	&lt;LI&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html&quot; target=_blank&gt;REST in PostgreSQL Part 2 A - The REST Server service with ASP.NET&lt;/a&gt; we demonstrated a REST web service using Mono.NET, MS.NET both in C#, VB.Net/Monobasic&lt;/LI&gt;
&lt;/OL&gt;
&lt;br /&lt;br /&gt;
Now in this Part 2B series, we shall demonstrate the same REST server service using PHP 
&lt;/P&gt;

&lt;h4&gt;Setting up the PHP application&lt;/h4&gt;
&lt;OL&gt;
	&lt;LI&gt;
		&lt;P&gt;PHP already has the PostgreSQL drivers available as a .so (on Linux) or .dll on Windows.  For windows users if you
			are running PHP under IIS and in ISAPI mode, you will not be able to dynamically load libraries, so you need to enable &lt;b&gt;php_pgsql&lt;/b&gt; in your PHP.ini file.
		&lt;/P&gt;
	&lt;/LI&gt;
	&lt;LI&gt;We tend to keep it enabled regardless of which platform we are on since a lot of our PHP development involves PostgreSQL.   The extension is &lt;i&gt;php_pgsql&lt;/i&gt; in the php.ini file&lt;/LI&gt;
	&lt;LI&gt;PHP has numerous database abstraction libraries to choose from.  We are using the adodb abstraction library for PHP which can be downloaded from &lt;a href=&quot;http://adodb.sourceforge.net/&quot; target=_blank&gt;http://adodb.sourceforge.net/&lt;/a&gt;.
&lt;/OL&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/42-REST-in-PostgreSQL-Part-2-B-The-REST-Server-service-with-PHP-5.html#extended&quot;&gt;Continue reading &quot;REST in PostgreSQL Part 2 B - The REST Server service with PHP 5&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 09 Apr 2008 22:28:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/42-guid.html</guid>
    
</item>
<item>
    <title>REST in PostgreSQL Part 2 A - The REST Server service with ASP.NET</title>
    <link>http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html</link>
            <category>application development</category>
            <category>intermediate</category>
            <category>mono .NET</category>
            <category>pagila</category>
            <category>tsearch</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=37</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;h4&gt;Setting up the .NET application&lt;/h4&gt;
&lt;OL&gt;
	&lt;LI&gt;
		&lt;P&gt;Download the npgsql 1.01 driver from pgfoundary - 
		&lt;a href=&quot;http://pgfoundry.org/projects/npgsql&quot; target=_blank&gt;http://pgfoundry.org/projects/npgsql&lt;/a&gt;.
		For ASP.NET 2.0 you&#039;ll want - Npgsql1.0.1-bin-ms2.0.zip and for Mono.NET you&#039;ll want Npgsql1.0.1-bin-mono-2.0.zip.  Unzip and place the files in bin folder of your web app project.
		&lt;/P&gt;
	&lt;/LI&gt;
	&lt;LI&gt;Since we are just creating a simple REST web service and don&#039;t need any plumming of the standard SOAP like webservice, we will be using
	a .NET handler class (ashx) instead of an asmx. We have two versions listed below.  One for C# and one for VB.NET/Mono Basic&lt;/LI&gt;
&lt;/OL&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/37-REST-in-PostgreSQL-Part-2-A-The-REST-Server-service-with-ASP.NET.html#extended&quot;&gt;Continue reading &quot;REST in PostgreSQL Part 2 A - The REST Server service with ASP.NET&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 18 Mar 2008 22:33:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/37-guid.html</guid>
    
</item>
<item>
    <title>REST in PostgreSQL Part 1 - The DB components</title>
    <link>http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html</link>
            <category>application development</category>
            <category>intermediate</category>
            <category>pagila</category>
            <category>plpgsql</category>
            <category>tsearch</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=36</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;In this section we&#039;ll go over creating the views and stored functions that our REST Server service will rely on.&lt;/P&gt;
&lt;P&gt;Our REST service will be a thin wrapper around a pgsql function that accepts film queries and returns results in XML.&lt;/P&gt;

&lt;h4&gt;Loading the database&lt;/h4&gt;
&lt;P&gt;&lt;b&gt;Step 1:&lt;/b&gt; Download the Pagila 0.10.0 database from 
&lt;a href=&quot;http://pgfoundry.org/frs/?group_id=1000150&amp;release_id=570&quot; target=&quot;_blank&quot;&gt;http://pgfoundry.org/frs/?group_id=1000150&amp;release_id=570&lt;/a&gt;
and load the Pagila database using the following commands: &lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;For windows users - psql is usually located at &lt;em&gt;&quot;C:\Program Files\PostgreSQL\8.3\bin\psql&quot;&lt;/em&gt;&lt;br /&gt;
&lt;PRE&gt;
&lt;CODE&gt;
psql -h localhost -p 5433 -U postgres -c &quot;CREATE DATABASE pagila ENCODING &#039;UTF8&#039;&quot;
psql -h localhost -p 5433 -U postgres -c &quot;CREATE ROLE pagila_app LOGIN PASSWORD &#039;pg@123&#039;&quot;
psql -h localhost -p 5433 -U postgres -d pagila -f &quot;pagila-schema.sql&quot;
psql -h localhost -p 5433 -U postgres -d pagila -f &quot;pagila-data.sql&quot;
&lt;/CODE&gt;
&lt;/PRE&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/36-REST-in-PostgreSQL-Part-1-The-DB-components.html#extended&quot;&gt;Continue reading &quot;REST in PostgreSQL Part 1 - The DB components&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 16 Mar 2008 18:33:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/36-guid.html</guid>
    
</item>
<item>
    <title>Showcasing REST in PostgreSQL - The PreQuel</title>
    <link>http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL-The-PreQuel.html</link>
            <category>application development</category>
            <category>intermediate</category>
            <category>pagila</category>
            <category>webservices</category>
    
    <comments>http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL-The-PreQuel.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=32</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;h4&gt;What is REST?&lt;/h4&gt;
&lt;P&gt;
Representationl State Transfer (REST) is a term to describe an architectural style of sharing information with consumers using already existing protocols such as HTTP. In the strictest sense of the term, the transport protocol need not be HTTP. &lt;/P&gt;
REST was first coined by &lt;a href=&quot;http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm&quot; target=_blank&gt;Roy Fielding in his
year 2000 doctoral thesis&lt;/a&gt;. Unlike things like Simple Object Access Protocol (SOAP), Distributed Component Object Model (DCOM), Common Object Request Broker Architecture (CORBA), it is not an architecture nor a protocol but rather a style
of architecture.  As a result, a lot of things that don&#039;t call themselves &lt;b&gt;RESTFUL&lt;/b&gt; full under that umbrella or use some of the same concepts, or can arguably fall under that umbrella.
&lt;/P&gt;
&lt;P&gt;What is probably so alluring about REST is that it gives a catchy name to something a lot of people were doing already and describes how much of the web operates. 
Contrary to some popular belief, it is not NEW technology but rather a grouping of mainstream technology with a flashier name.  Part of this confusion is that the cult following of REST is a fairly new phenomenon although the underpinnings are relatively old.  The REST movement reflects a return back to the basics that prioritizes simplicity and accessibility over complexity and formality.
Nowadays REST is most often used to refer to web services where resources are requested via plain URIs and GET requests, representations are returned in simple XML or JSON format and resources are created using POST, updated using PUT and deleted using DELETE HTTP verbs.  This is similar to XML-RPC except that
XML-RPC has a concept of state and everything is generally encoded in an XML message envelop. XML-RPC also uses POST for both updating and accessing resources unlike REST which tends to use GETS and URIS for resource access. The advantage of using get is that resources can be bookmarked.  SOAP is similar to XML-RPC and in fact was born from the XML-RPC standard except the XML message streams are more complicated and formal, but arguably richer in functionality.&lt;/P&gt;

&lt;P&gt;Contrary to some popular belief, REST is not a silver bullet nor was it designed to be.  It doesn&#039;t work for all problems and web applications.  Our personal opinion: REST is well suited for transporting data that will be consumed by various kinds
of clients, but is not well suited for updating of data or where authenticated transactions are needed. &lt;/P&gt;

&lt;P&gt;REST has 4 basic features that differentiate/and it shares with similar Architectural styles.  

&lt;OL&gt;
	&lt;LI&gt;&lt;b&gt;Client Stateless Server&lt;/b&gt; - As the name suggests - the state of an object is part of the message, and is commonly referred to as a stateless communication.  It is not done with things like Session cookies where the 
	server maintains some stateful view of the client and the client passes a session cookie saying (here is my ticket - give me my state).  The server does not hold information about state, only the client.  
	Right away one can tell - this can not work for all modes of communication that require immense amounts of state information to be maintained, but does have the advantage of should the application server hiccup or connection to the server times out or breaks only the current message is lost.  
	It also works well for Web-Farms that are simply outputing data since the need for such Web-Farms to replicate state is not needed (think image caching networks such as Akamai).&lt;/LI&gt;
	&lt;LI&gt;&lt;b&gt;Client-Cache&lt;/b&gt; - The idea of client caching.  The server can dictate certain requests as being cacheable and if cacheable a client can use the cache request to satisfy future similar requests instead of going back to the server.  This saves on band-width but has disadvantage of possibly resulting in stale results. Keep in mind again this concept is not
	new and most webservers are designed to work that way and pass this info via http headers.&lt;/LI&gt;
	&lt;LI&gt;&lt;b&gt;Layered System&lt;/b&gt; - two way interaction.  In a REST style architecture, there is a client and a server.  The client is only dependent on the server it communicates with.  It has no knowledge of the components the server uses to fulfill its request.  
	That server can be a client in another REST interaction and keep its own cache to serve up like requests.  This does not break the &lt;i&gt;client keeps the cache&lt;/i&gt; rule as the server is acting as a client in this context.  Think &lt;b&gt;DNS&lt;/b&gt;. DNS is a perfect example of such a style where intermediaries cache 
	requests for a certain period of time and act as clients to DNS servers further up the root and behave as servers to DNS and client computers below.&lt;/LI&gt;
	&lt;LI&gt;&lt;b&gt;Resource and Resource Identifiers&lt;/b&gt; - REST is predominantly a mechanism for accessing resources although it can be used for editing as well.  The
	key element of it is a mechanism for defining resources, 
		how a resource or grouping of resources are requested via a Resource Identifier (URL or URN), transfer of representation via (HTML, XML, Jpeg etc.),
			representational metadata  (e.g. media type, last modified), control data (such as how long it can be cached). Yes this is pretty much 
			a common concept in web interfaces.&lt;/LI&gt;
&lt;/OL&gt; &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/32-Showcasing-REST-in-PostgreSQL-The-PreQuel.html#extended&quot;&gt;Continue reading &quot;Showcasing REST in PostgreSQL - The PreQuel&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 12 Mar 2008 06:49:00 -0400</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/32-guid.html</guid>
    
</item>
<item>
    <title>Using MS Access with PostgreSQL</title>
    <link>http://www.postgresonline.com/journal/archives/24-Using-MS-Access-with-PostgreSQL.html</link>
            <category>application development</category>
            <category>intermediate</category>
            <category>ms access</category>
            <category>pagila</category>
            <category>tsearch</category>
    
    <comments>http://www.postgresonline.com/journal/archives/24-Using-MS-Access-with-PostgreSQL.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=24</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;
Many in the PostgreSQL community use Microsoft Access as a front-end to their PostgreSQL databases.
Although MS Access is strictly a windows application and PostgreSQL has its roots in Unix, the two go well together.  A large part of that reason is because
the PostgreSQL ODBC driver is well maintained and has frequent updates.  You can expect one new ODBC driver release every 4-6 months.  There exist only 32-bit production quality drivers.  The 64-bit driver is of alpha quality.  In addition to other front-ends to PostgreSQL that utilize the ODBC driver used by Windows developers, there is VB 6 (VB.NET/C# use the ADO.NET driver also very well maintained), Visual FoxPro, Delphi, to name a few).
&lt;/P&gt;

&lt;P&gt;People who have never used Microsoft Access or anything like it and consider themselves hard-core programmers or database purists, dismiss Microsoft Access as a dangerous child&#039;s toy, causing nothing but grief when real programmers and database administrators have to debug the
disorganized mess of amateurs.  They dream of the day when this nuisance is rid of and their company can be finally under the strict bureaucratic control of well-designed apps that no one cares to use.&lt;/P&gt;
&lt;P&gt;
Beneath the croft of this dinkiness/dangerous toy is a RAD and Reporting tool that
can connect to any database with an ODBC or ADO driver.  It serves the unique niche of &lt;br /&gt;
&lt;OL&gt;&lt;LI&gt;Empowering a knowledge worker/beginner programmer/DB user who is slowly discovering the wonders of relational databases and what time savings such a tool can provide.&lt;/LI&gt; 
&lt;LI&gt;On the other side - it is inviting to the pragmatic (lazy) database programmer who has spent precious time to investigate its gems. The pragmatist sees it as a tool which provides a speedy development environment and intuitive reporting environment. It allows one to give more freedom to less experienced users, thus relieving one of tedious requests for information. By using it as a front-end to a strong server-side database such as PostgreSQL, it allows one to enforce a sufficient 
level of data integrity and control.  The pragmatist realizes that often the best way to maintain order is to not fight disorder because the more you try to restrict 
people&#039;s freedoms, the craftier they get in devising ways of circumventing your traps.
The pragmatic programmer also takes the view of &lt;em&gt;Give a man a fish and he will pester you for more fish.  Teach a man to fish and he will help you catch bigger fish.&lt;/em&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;/P&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/24-Using-MS-Access-with-PostgreSQL.html#extended&quot;&gt;Continue reading &quot;Using MS Access with PostgreSQL&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 31 Jan 2008 12:17:00 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/24-guid.html</guid>
    <category>msaccess</category>

</item>
<item>
    <title>Database Abstraction with Updateable Views</title>
    <link>http://www.postgresonline.com/journal/archives/11-Database-Abstraction-with-Updateable-Views.html</link>
            <category>advanced</category>
            <category>application development</category>
    
    <comments>http://www.postgresonline.com/journal/archives/11-Database-Abstraction-with-Updateable-Views.html#comments</comments>
    <wfw:comment>http://www.postgresonline.com/journal/wfwcomment.php?cid=11</wfw:comment>

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

    <author>nospam@example.com (Leo Hsu and Regina Obe)</author>
    <content:encoded>
    &lt;P&gt;One of the annoying things about PostgreSQL unlike some other databases we have worked with is that simple views
are not automatically updateable.  There is some work involved to make views updateable.  For simple views, 
this is annoying, but for more complex views it is a benefit to be able to control how things are updated.  In a later version of PostgreSQL perhaps 8.4 or 8.5 this will
be ratified and PostgreSQL will enjoy the same simplicity of creating simple updateable views currently offered by MySQL and SQL Server and other DBMSs, but 
still allow for defining how things should be updated for more complex views.  For this exercise we are using PostgreSQL 8.2.5, but most of it should work 
for lower versions with slight modification.
&lt;/P&gt;

&lt;P&gt;For this exercise, we shall create a fairly complex updateable view to demonstrate how one goes about doing this. &lt;/P&gt;

&lt;P&gt;Here is a scenario where being able to control how a view is updated comes in very handy. &lt;/P&gt;
&lt;p&gt;We all know relational databases are great because they give you great 
mobility on how you slice and dice information.  At times for data entry purposes, the good old simple flat file is just more user-friendly.&lt;/P&gt;

&lt;P&gt;&lt;b&gt;Problem:&lt;/b&gt;  You are developing an inventory application for a molecular biology lab and they have the following requirements: &lt;br /&gt;
&lt;OL&gt;&lt;LI&gt;They want to keep track of how much of each supply they use for each project grant for funding purposes and report on that monthly or daily.&lt;/LI&gt;
	&lt;LI&gt;They want to keep track of how much of each supply they ordered, what they have left and their usage over time.&lt;/LI&gt;
	&lt;LI&gt;They however want data entry to be as simple as possible.  They want a simple flat file structure to input data that has columns for each project usage and column for purchase quantity.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;
They have 2 projects going on. One on Multiple Sclerosis Research (MS) and one on Alzheimer&#039;s. Each is funded by different grants and for grant cost allocation purposes, they need to keep track of the supplies they use on each project.&lt;br /&gt;
How do you present a flat file inventory entry screen, but behind the scenes have a inventory and inventory transaction scheme so you can run period reports and aggregate summaries and have automatic totaling?
&lt;br /&gt;&lt;b&gt;Possible Solution:&lt;/b&gt; One way to do it is with a crosstab summary view that is updateable. Views are incredibly useful abstraction tools. 
You do that in PostgreSQL by creating insert, update, and delete rules on your views. For our particular case, we will not be allowing deletion so we will not have a delete rule.
&lt;/P&gt;
&lt;p&gt;In our system we have 2 tables for simplicity. inventory and inventory_flow.  I know we should have a project lookup table or in 8.3 possibly use an ENUM, but to make this short, we are skipping that.&lt;/p&gt;

&lt;PRE&gt;
&lt;CODE&gt;
CREATE TABLE inventory
(
  item_id serial NOT NULL,
  item_name varchar(100) NOT NULL,
  CONSTRAINT pk_inventory PRIMARY KEY (item_id),
  CONSTRAINT inventory_item_name_idx UNIQUE (item_name)
)
WITH (OIDS=FALSE);


CREATE TABLE inventory_flow
(
  inventory_flow_id serial NOT NULL,
  item_id integer NOT NULL,
  project varchar(100),
  num_used integer,
  num_ordered integer,
  action_date timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
  CONSTRAINT pk_inventory_flow PRIMARY KEY (inventory_flow_id),
  CONSTRAINT fk_item_id FOREIGN KEY (item_id)
      REFERENCES inventory (item_id) 
      ON UPDATE CASCADE ON DELETE RESTRICT
)
WITH (OIDS=FALSE);



CREATE VIEW vwinventorysummary As 
	SELECT i.item_id, i.item_name, 
SUM(CASE WHEN iu.project = &#039;Alzheimer&#039;&#039;s&#039; 
               THEN iu.num_used ELSE 0 END) As total_num_used_altz, 
	   SUM(CASE WHEN iu.project = &#039;MS&#039; THEN iu.num_used ELSE 0 END) As total_num_used_ms, 
           CAST(NULL As integer) As add_num_used_altz, 
           CAST(NULL As integer) As add_num_used_ms,
           CAST(NULL As integer) As add_num_ordered, 
	   SUM(COALESCE(iu.num_ordered,0)) - SUM(COALESCE(iu.num_used,0)) As num_remaining
	FROM inventory i LEFT JOIN inventory_flow iu ON i.item_id = iu.item_id
	GROUP BY i.item_id,  i.item_name;
	
	CREATE RULE updinventory AS
		ON UPDATE TO vwinventorysummary
			DO INSTEAD (
				UPDATE inventory 
                                   SET item_name = NEW.item_name WHERE inventory.item_id = NEW.item_id;

				INSERT INTO inventory_flow(item_id, project, num_used, num_ordered)
						SELECT NEW.item_id, &#039;Alzheimer&#039;&#039;s&#039;, NEW.add_num_used_altz, 0
						WHERE NEW.add_num_used_altz IS NOT NULL; 
				INSERT INTO inventory_flow(item_id, project, num_used, num_ordered)
						SELECT NEW.item_id, &#039;MS&#039;, NEW.add_num_used_ms, 0
						WHERE NEW.add_num_used_ms IS NOT NULL;
				INSERT INTO inventory_flow(item_id, project, num_used, num_ordered)
						SELECT NEW.item_id, &#039;Resupply&#039;, 0, NEW.add_num_ordered						
				WHERE NEW.add_num_ordered IS NOT NULL;);
	
	CREATE RULE insinventory AS
		ON INSERT TO vwinventorysummary 
		DO INSTEAD ( 
			INSERT INTO inventory (item_name) VALUES (NEW.item_name);
			INSERT INTO inventory_flow (item_id, project, num_used)  
                            SELECT i.item_id AS new_itemid, &#039;Altzeimer&#039;&#039;s&#039;, NEW.add_num_used_altz
					FROM inventory i 
					WHERE i.item_name = NEW.item_name 
                                           AND NEW.add_num_used_altz IS NOT NULL;

			INSERT INTO inventory_flow (item_id, project, num_used)  
                          SELECT i.item_id AS new_item_id, &#039;MS&#039;, NEW.add_num_used_ms
				FROM inventory i
                                WHERE i.item_name = NEW.item_name AND
                                         NEW.add_num_used_ms IS NOT NULL;

			INSERT INTO inventory_flow (item_id, project, num_ordered)  
                             SELECT i.item_id AS new_item_id, &#039;Initial Supply&#039;, NEW.add_num_ordered
				FROM inventory i 
					WHERE i.item_name = NEW.item_name AND   
                                          NEW.add_num_ordered IS NOT NULL;
		);

&lt;/CODE&gt;
&lt;/PRE&gt;

&lt;P&gt;Now look at what happens when we insert and update our view&lt;/P&gt;
&lt;PRE&gt;
&lt;CODE&gt; --NOTE: here we are using the new multi-row valued insert feature introduced in 8.2
	INSERT INTO vwinventorysummary(item_name, add_num_ordered) 
		VALUES (&#039;Phenol (ml)&#039;, 1000), (&#039;Cesium Chloride (g)&#039;, 20000),
				(&#039;Chloroform (ml)&#039;, 10000), (&#039;DNA Ligase (ml)&#039;, 100);
				
	UPDATE vwinventorysummary 
                SET add_num_used_ms = 5, add_num_used_altz = 6 WHERE item_name = &#039;Cesium Chloride (g)&#039;;
	UPDATE vwinventorysummary SET add_num_used_ms = 2 WHERE item_name = &#039;Phenol (ml)&#039;;
	UPDATE vwinventorysummary SET item_name = &#039;CSCL (g)&#039; WHERE item_name = &#039;Cesium Chloride (g)&#039;;
&lt;/CODE&gt;
&lt;/PRE&gt;

&lt;P&gt;The slick thing about this is if you were to create a linked table in something like say Microsoft Access and designated item_id as the primary key, 
then the user could simply open up the table and update as normally and behind the scenes the rules would be working to do the right thing.
&lt;/P&gt; 
    </content:encoded>

    <pubDate>Fri, 07 Dec 2007 02:26:54 -0500</pubDate>
    <guid isPermaLink="false">http://www.postgresonline.com/journal/archives/11-guid.html</guid>
    
</item>

</channel>
</rss>
