<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="http://www.designmagick.com/templates/newdesign/rssdisplay.xslt" type="text/xsl" ?>
<rss version="2.0">
  <channel>
	<title>PostgreSQL &amp; PHP Tutorials - Rss Feeds</title>
	<link>http://www.designmagick.com/rss.php</link>
	<description />
	<language>en-us</language>
	<generator>MyCMS (copyright DesignMagick)</generator>
	<webMaster>chris@designmagick.com</webMaster>
	<lastBuildDate>Wed, 22 May 2013 23:06:40 -0400</lastBuildDate>
	<ttl>20</ttl>

	<item>
  <title>Group Concat In PostgreSQL</title>
  <link>http://www.designmagick.com/article/38/Group-Concat-In-PostgreSQL</link>
  <description>Group Concat is a useful mysql function, but how do we get the same results in PostgreSQL?&lt;br /&gt;
</description>
  <pubDate>Sat, 16 Jun 2007 07:55:49 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/article/38/Group-Concat-In-PostgreSQL</guid>
</item>
<item>
  <title>Database Design Issues</title>
  <link>http://www.designmagick.com/blogs/37/Database-Design-Issues</link>
  <description>Creating a good database design takes some thought. Sometimes, a normalized database won't perform the way you want it. Using some features of postgresql, you could get your performance back.&lt;br /&gt;
&lt;br /&gt;
I decided to use some functions and triggers to keep queries nice and simple, but not lose any functionality and keep data redundancy to a minimum.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.designmagick.com/article/36/Forum-Project/Database-Design-Issues&quot; target=&quot;_blank&quot;&gt;Read more..&lt;/a&gt;&lt;br /&gt;
</description>
  <pubDate>Thu, 20 Apr 2006 10:15:52 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/blogs/37/Database-Design-Issues</guid>
</item>
<item>
  <title>Database Design Issues</title>
  <link>http://www.designmagick.com/article/36/Database-Design-Issues</link>
  <description>Database normalization and design issues is a difficult topic to write about. A lot of it depends on the application you are writing and how you want to access the data.&lt;br /&gt;
&lt;br /&gt;
Whilst writing my forum, I decided to do things slightly differently to a normalized setup to speed things up.&lt;br /&gt;
&lt;br /&gt;
Here's a look at how to achieve some nice improvements by adjusting a database design and using some postgresql features like triggers and functions.&lt;br /&gt;
</description>
  <pubDate>Thu, 20 Apr 2006 08:54:51 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/article/36/Database-Design-Issues</guid>
</item>
<item>
  <title>Forum Progress Part II</title>
  <link>http://www.designmagick.com/blogs/35/Forum-Progress-Part-II</link>
  <description>The forum is very slowly getting put together. The basic admin areas are done:&lt;br /&gt;
&lt;br /&gt;
- forums have group access&lt;br /&gt;
- groups can have users&lt;br /&gt;
&lt;br /&gt;
Since most of the work is done on the frontend, I have been putting the design together and working out how to keep things in check.&lt;br /&gt;
&lt;br /&gt;
Since postgresql has advanced features, I've decided to use some of those.&lt;br /&gt;
&lt;br /&gt;
Instead of having to do a query to get thread counts and post counts per forum, I'll use a trigger to keep this info up to date when a thread or post is added to a particular forum.&lt;br /&gt;
&lt;br /&gt;
I also use a &lt;a href=&quot;http://www.postgresql.org/docs/8.1/static/plpgsql-trigger.html&quot; target=&quot;_blank&quot;&gt;plpgsql&lt;/a&gt; &lt;a href=&quot;http://www.postgresql.org/docs/8.1/static/triggers.html&quot; target=&quot;_blank&quot;&gt;trigger &lt;/a&gt; to keep the &quot;last post time&quot;, &quot;last post author&quot; and &quot;last post id&quot; (which makes navigating a particular forum a little easier).&lt;br /&gt;
&lt;br /&gt;
Lastly, if a forum, group, or user gets deleted, then it will clean up after itself by using &lt;a href=&quot;http://www.postgresql.org/docs/8.1/static/ddl-constraints.html#DDL-CONSTRAINTS-FK&quot; target=&quot;_blank&quot;&gt;referential integrity checks&lt;/a&gt; and &quot;on delete cascade&quot; triggers. This will cause postgresql to delete anything that refers to a particular item.&lt;br /&gt;
&lt;br /&gt;
Much easier than having to replicate that functionality in code and missing something!</description>
  <pubDate>Mon, 17 Apr 2006 09:27:34 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/blogs/35/Forum-Progress-Part-II</guid>
</item>
<item>
  <title>Site update</title>
  <link>http://www.designmagick.com/news/34/Site-update</link>
  <description>I finally got around to adding an area for users to submit articles.&lt;br /&gt;
&lt;br /&gt;
You have to be logged in to submit an article - that saves me having to worry about the form being used for spam, random php scripts trying to be used to hack the site and so on..&lt;br /&gt;
&lt;br /&gt;
So, if you want to submit something, go for it!&lt;br /&gt;
</description>
  <pubDate>Mon, 03 Apr 2006 05:59:20 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/news/34/Site-update</guid>
</item>
<item>
  <title>Forum Progress</title>
  <link>http://www.designmagick.com/blogs/33/Forum-Progress</link>
  <description>I haven't made much progress with the new forum yet, but I've worked out how to manage permissions.&lt;br /&gt;
&lt;br /&gt;
At the bottom level will be users.&lt;br /&gt;
&lt;br /&gt;
Users will be in groups.&lt;br /&gt;
&lt;br /&gt;
Groups will have permissions in particular forums (so a user can be a forum moderator in a particular forum, but a simple user in another).&lt;br /&gt;
&lt;br /&gt;
So permissions are basically worked out (writing the API will be a little bit of work but shouldn't be too difficult now I've worked out the logic behind it all).&lt;br /&gt;
&lt;br /&gt;
Then, forums will (potentially) have subforums.&lt;br /&gt;
&lt;br /&gt;
A forum will have many threads.&lt;br /&gt;
</description>
  <pubDate>Sun, 02 Apr 2006 08:59:11 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/blogs/33/Forum-Progress</guid>
</item>
<item>
  <title>Introduction to Database Joins</title>
  <link>http://www.designmagick.com/article/32/Introduction-to-Database-Joins</link>
  <description>Database joins are an essential skill to learn, whether it's using PostgreSQL or any other database management system.</description>
  <pubDate>Sun, 02 Apr 2006 08:34:24 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/article/32/Introduction-to-Database-Joins</guid>
</item>
<item>
  <title>Creating a Cache</title>
  <link>http://www.designmagick.com/article/31/Creating-a-Cache</link>
  <description>I decided to create a simple cache system for this site, to cut down on the number of database queries being run.&lt;br /&gt;
&lt;br /&gt;
Here's a look at how I did it, what it caches and how simple it is to get up and running.&lt;br /&gt;
</description>
  <pubDate>Sun, 02 Apr 2006 07:08:32 -0400</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/article/31/Creating-a-Cache</guid>
</item>
<item>
  <title>New project</title>
  <link>http://www.designmagick.com/blogs/30/New-project</link>
  <description>I've decided to do something a little more constructive than random tutorials.&lt;br /&gt;
&lt;br /&gt;
I've been looking for a forum to put on the site to make it a bit more interactive, but haven't been able to find anything suitable.&lt;br /&gt;
&lt;br /&gt;
Either they are mysql-only or security-issue prone.&lt;br /&gt;
&lt;br /&gt;
Fud-forum works with postgresql but doesn't take advantage of a lot of postgresql features (like subqueries) because it has to work in mysql and postgresql - so it does a ton of queries with every page.&lt;br /&gt;
&lt;br /&gt;
So, what features am I looking for?&lt;br /&gt;
&lt;br /&gt;
On the tech side:&lt;br /&gt;
&lt;br /&gt;
- postgresql support&lt;br /&gt;
- clean, fast&lt;br /&gt;
- nice interface&lt;br /&gt;
- limited sql queries&lt;br /&gt;
- possibly caching.&lt;br /&gt;
&lt;br /&gt;
On the design/interface side:&lt;br /&gt;
- clean&lt;br /&gt;
- template based&lt;br /&gt;
- fast&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have any suggestions on where to start looking for such a forum, or have any feature suggestions send 'em through!&lt;br /&gt;
&lt;br /&gt;
Might see if I can set up a cvs or subversion server and get others to help me out ;) Let me know if you're interested.&lt;br /&gt;
</description>
  <pubDate>Tue, 28 Mar 2006 06:02:52 -0500</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/blogs/30/New-project</guid>
</item>
<item>
  <title>PostgreSQL Enum Types</title>
  <link>http://www.designmagick.com/article/29/PostgreSQL-Enum-Types</link>
  <description>An enum datatype allows only certain values to be entered into a particular field (for example - 'red', 'blue', 'yellow', 'purple' for favourite colours).&lt;br /&gt;
&lt;br /&gt;
Postgresql doesn't have an enum datatype, but we can emulate it quickly and easily.&lt;br /&gt;
&lt;br /&gt;
Instead of an enum type we can set up a CHECK CONSTRAINT - this tells postgresql to make sure that the value we are entering is valid.&lt;br /&gt;
&lt;br /&gt;
CREATE TABLE person (&lt;br /&gt;
  personid int not null primary key,&lt;br /&gt;
  favourite_colour varchar(255) NOT NULL,&lt;br /&gt;
  CHECK (favourite_colour IN ('red', 'blue', 'yellow', 'purple'))&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
Now that's done, let's check it works:&lt;br /&gt;
&lt;br /&gt;
test=# insert into person(personid, favourite_colour) values (1, 'red');&lt;br /&gt;
INSERT 0 1&lt;br /&gt;
&lt;br /&gt;
Now for something not in the list:&lt;br /&gt;
&lt;br /&gt;
test=# insert into person(personid, favourite_colour) values (2, 'green');&lt;br /&gt;
ERROR:  new row for relation &quot;person&quot; violates check constraint &quot;person_favourite_colour_check&quot;&lt;br /&gt;
&lt;br /&gt;
Done! Nice and easy!</description>
  <pubDate>Sun, 26 Mar 2006 07:22:55 -0500</pubDate>
  <author>chris@designmagick.com (Chris Smith)</author>
  <guid>http://www.designmagick.com/article/29/PostgreSQL-Enum-Types</guid>
</item>


  </channel>
</rss>
