All About PostgreSQL

1 - I can do better 2 - Jury's out 3 - Pretty darn good 4 - Splendiferous 5 - Awesometastic by 0 people | Log in to rate

Ranked #7,057 in Tech & Geek, #168,620 overall

Welcome to All About PostgreSQL

This lens aggregates postgresql news, information and blogs from around the web.  Check back frequently for updates.  If you don't see your favorite PostgreSQL blog linked, send me an email and I will add it.

Links to Visit 

PostgreSQL
The Official PostgreSQL Home Page.
PostgreSQL DB News
News and Commentary regarding the open source database, PostgreSQL.
EnterpriseDB News
News and Commentary regarding EnterpriseDB, the Oracle compatible database built from PostgreSQL.
EnterpriseDB Postgres Resource Center
EnterpriseDB Postgres Resource Center: Forums, Documentation, Support, Downloads
PostgreSQL Mail Lists
Postgres Related Mail Lists

Create a simple function in Postgres PL/pgSQL 

CREATE OR REPLACE FUNCTION func_1()
RETURNS CHAR VARYING(25)
AS $$
DECLARE
local_char_var CHAR(30);
BEGIN
SELECT datname
INTO local_char_var
FROM pg_database
LIMIT 1;

RETURN local_char_var;
END;
$$ LANGUAGE plpgsql;

Ok. Now we'll go through it line by line:

1. CREATE OR REPLACE FUNCTION func_1() - This line creates and names the function. The "OR REPLACE" will let us modify the function without fir DROPping it. func_1 can be any valid PLpgSQL name. Even if you are not declaring parameters, you must include the parenthesis ().

2. RETURNS CHAR VARYING(25) - RETURNS is the keyword that signifies what data type the function will be returing. RETURN is the equivalent in PL/SQL. Notice the S. CHAR VARYING is the equivalent of a VARCHAR2 in PL/SQL. In this case it will be a VARCHAR2(25).

3. AS $$ - AS is the same as the PL/SQL AS. The $$ is the function code delimiter. You can actually use single quotes here instead of $$ but in that case you would need to double all the quotes in your code. If that doesn't make sense, just consider the $$ mandatory. PLpgSQL is a more basic language than PL/SQL. The code is stored as text and compiled as it is run. The entire function body is just a string and the $$ is the delimiter.

Read the rest of this entry.

Call a Function in PL/pgSQL 

To call either a function, you can run:

SELECT func_1();

Or

SELECT * FROM func_1();

The PostgreSQL Blog Feed 

Blog Feeds From Around the Web

If you don't see your favorite blog here, send me a note and I will add it!

Loading Fetching RSS feed... please stand by

Postgres Comparisons 


  1. PostgreSQL vs Firebird, August 2007 (and hopefully it will remain updated)

  2. PostgreSQL vs. SQL Server: PostgreSQL is right for the Microsoft stack, SearchEntepriseLinux May 15, 2006

  3. PostgreSQL vs. Oracle: Users speak out, SeachOracle April 6, 2006

  4. Oracle 10g vs PostgreSQL 8 vs MySQL 5, This one I wrote, Aug 22, 2005

  5. MySQL vs. PostgreSQL, Aug 9, 2005

  6. PostgreSQL vs MySQL with Rails, June 18, 2005

  7. PostgreSQL or MySQL - Feb 15 2005, a fairly nice comparison actually.

  8. PostgreSQL vs. MySQL vs. Commercial Databases: It's All About What You Need - DevX April 12, 2004

  9. PostgreSQL vs MySQL: Which is better?, DatabaseJournal Dec 16, 2003

  10. Firebird vs Postgres, Forum Post, April 23, 2002

  11. PostgreSQL vs. MySQL (Web Techniques, Sep 2001), Dr Dobbs, Jan 1, 2002

PostgreSQL Plexo 

Which is the BEST PostgreSQL book?

Vote UP for your favorite or vote DOWN the one you hate! Add your own, too!

PostgreSQL (2nd Edition) (Developer's Library) by Korry Douglas

PostgreSQL (2nd Edition) (Developer's Library) by Korry Douglas

This is my favorite PostgreSQL book. It's good for more...1 point

Beginning PHP and PostgreSQL 8: From Novice to Professional by W. Jason Gilmore

Beginning PHP and PostgreSQL 8: From Novice to Professional by W. Jason Gilmore

This is probably my second favorite postgres book. more...1 point

Beginning Databases with PostgreSQL: From Novice to Professional, Second Edition (Beginning from Novice to Professional) by Neil Matthew

Beginning Databases with PostgreSQL: From Novice to Professional, Second Edition (Beginning from Novice to Professional) by Neil Matthew

Another good book but not as in depth as some othe more...0 points

PostgreSQL: Introduction and Concepts by Bruce Momjian

PostgreSQL: Introduction and Concepts by Bruce Momjian

A classic but somewhat dated now.0 points

PostgreSQL and OSD News 

Loading Fetching RSS feed... please stand by

New Guestbook 

ChipsTrip wrote...

Hi, This is a valuable hub. Very useful.
Does anybody else out here need a travel break?
...what can you do if travel is a dim dream? Here is a short term solution. Travel virtually!

Example: On this travel quiz you can even add your own questions to create a personal touch.
http://www.mystudiyo.com/act61911/mini/go/travel_the_world_quiz

Its easy to drift away into these travel video guides.
Even for those of us who love travel it is not always easy to get out there. These guys created a short-term solution. 19 countries are already included with up-close & personal journeys... You can add and upload your own stuff. Its quite useful also to preview the location for a next vacation.

Share and explore. It's free @ www.GlobeTrip.net

Here are a couple of fun travel polls with good linked video footage.
Fun to enjoy & share.
http://pollsb.com/polls/poll/13375
http://pollsb.com/polls/poll/13416

These are super easy to embed into almost any page for great content.
Have fun & safe travel.

ReplyPosted May 28, 2008

JayGodse wrote...

You seem to have compared PostgreSQL with all the major databases except SQLite. Do you have any comparisons?

ReplyPosted March 20, 2008

by lewisc

Lewis Cunningham is an Author, Blogger and Database Architect.  He has worked in the Finance, Military, Airline Travel, Higher Education, Softwar...

(more)

Explore related pages

Create a Lens!