<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"
	>
<channel>
	<title>Comments on: Connecting to postgresql from a range of different front-ends</title>
	<atom:link href="http://www.archaeogeek.com/blog/2008/06/09/connecting-to-postgresql-from-a-range-of-different-front-ends/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.archaeogeek.com/blog/2008/06/09/connecting-to-postgresql-from-a-range-of-different-front-ends/</link>
	<description>Travels in a digital world</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:03:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.archaeogeek.com/blog/2008/06/09/connecting-to-postgresql-from-a-range-of-different-front-ends/comment-page-1/#comment-24925</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 18 Jun 2008 10:44:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.archaeogeek.com/blog/?p=143#comment-24925</guid>
		<description>Hey ChrisW, Thanks for the rant! In general I agree with you- but... with my comment I was thinking of lookup tables. Since all they are doing is providing values for dropdown lists and such like, they are not really part of the relational database because you don&#039;t relate data in your main tables to them- you wouldn&#039;t want cascading updates or deletes, and as such you can get away without a primary key. In general I would always include one, but I don&#039;t think in those cases it&#039;s totally necessary. Everything else though- agreed!</description>
		<content:encoded><![CDATA[<p>Hey ChrisW, Thanks for the rant! In general I agree with you- but&#8230; with my comment I was thinking of lookup tables. Since all they are doing is providing values for dropdown lists and such like, they are not really part of the relational database because you don&#8217;t relate data in your main tables to them- you wouldn&#8217;t want cascading updates or deletes, and as such you can get away without a primary key. In general I would always include one, but I don&#8217;t think in those cases it&#8217;s totally necessary. Everything else though- agreed!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ChrisW</title>
		<link>http://www.archaeogeek.com/blog/2008/06/09/connecting-to-postgresql-from-a-range-of-different-front-ends/comment-page-1/#comment-24754</link>
		<dc:creator>ChrisW</dc:creator>
		<pubDate>Sat, 14 Jun 2008 15:33:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.archaeogeek.com/blog/?p=143#comment-24754</guid>
		<description>&quot;always include a primary key in any tables you expect people to select or edit data in&quot;

As a database developer, I&#039;d go a little further and emphasise that you really must define a primary key for *every* table in a relational database such as Postgres, Oracle etc.  This is a fundamental requirement of the relational database model - if you can&#039;t define a way to identify each row in your table uniquely (the PK) then you haven&#039;t finished normalising the data in the first place.

From a practical point of view, many DB tools expect you to have performed this basic step and may not work properly without a PK for each table.  For example, the DB itself can use your PK definition to make sure you don&#039;t accidentally create duplicate rows in a table.  Also, PKs are typically indexed by default, so defining a PK will also speed up access to the data.  Other tools, such as Java DB interfaces using Hibernate etc, will not work without a PK for each table.  

Similar arguments apply to foreign keys i.e. when you include the PK of a row from table A inside a record in table B, so you can relate the &quot;child&quot; data in B back to its &quot;parent&quot; row in A.  Defining a foreign key allows the DB to check that the parent row exists when you try to add a child record, so you can avoid creating &quot;orphaned&quot; data.  Also, the DB can enforce extra rules based on the FK e.g. warning you if you try to delete a parent record which still has children, or &quot;cascading&quot; the delete to remove the children as well as the parent. And FKs are usually good candidates for indexing, as you often search for data using them, and indexing FKs will often speed up your DB access.  

Again, this is a fundamental part of relational DB design:  if you haven&#039;t done this, you haven&#039;t got a proper database, just a bunch of unrelated data.

Sorry to rant, but I&#039;ve encountered too many &quot;databases&quot; where people have simply dumped their spreadsheets into an RDBMS without bothering to create a basic relational data model first (e.g. work out what the keys are for each table), then complain because their &quot;database&quot; is too slow, filled with rubbish/duplicate rows/orphans etc.

But I feel much better now.</description>
		<content:encoded><![CDATA[<p>&#8220;always include a primary key in any tables you expect people to select or edit data in&#8221;</p>
<p>As a database developer, I&#8217;d go a little further and emphasise that you really must define a primary key for *every* table in a relational database such as Postgres, Oracle etc.  This is a fundamental requirement of the relational database model &#8211; if you can&#8217;t define a way to identify each row in your table uniquely (the PK) then you haven&#8217;t finished normalising the data in the first place.</p>
<p>From a practical point of view, many DB tools expect you to have performed this basic step and may not work properly without a PK for each table.  For example, the DB itself can use your PK definition to make sure you don&#8217;t accidentally create duplicate rows in a table.  Also, PKs are typically indexed by default, so defining a PK will also speed up access to the data.  Other tools, such as Java DB interfaces using Hibernate etc, will not work without a PK for each table.  </p>
<p>Similar arguments apply to foreign keys i.e. when you include the PK of a row from table A inside a record in table B, so you can relate the &#8220;child&#8221; data in B back to its &#8220;parent&#8221; row in A.  Defining a foreign key allows the DB to check that the parent row exists when you try to add a child record, so you can avoid creating &#8220;orphaned&#8221; data.  Also, the DB can enforce extra rules based on the FK e.g. warning you if you try to delete a parent record which still has children, or &#8220;cascading&#8221; the delete to remove the children as well as the parent. And FKs are usually good candidates for indexing, as you often search for data using them, and indexing FKs will often speed up your DB access.  </p>
<p>Again, this is a fundamental part of relational DB design:  if you haven&#8217;t done this, you haven&#8217;t got a proper database, just a bunch of unrelated data.</p>
<p>Sorry to rant, but I&#8217;ve encountered too many &#8220;databases&#8221; where people have simply dumped their spreadsheets into an RDBMS without bothering to create a basic relational data model first (e.g. work out what the keys are for each table), then complain because their &#8220;database&#8221; is too slow, filled with rubbish/duplicate rows/orphans etc.</p>
<p>But I feel much better now.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

