Re: PL/pgSQL compatibility? - Mailing list pgsql-general

From Joel Burton
Subject Re: PL/pgSQL compatibility?
Date
Msg-id 3A3118AB.26169.149880A@localhost
Whole thread Raw
In response to PL/pgSQL compatibility?  (Soma Interesting <dfunct@telus.net>)
List pgsql-general
On 8 Dec 2000, at 13:35, Soma Interesting wrote:

> One con, I understand, would be ability to migrate to another DBMS. If
> I were to use PL/pgSQL for my stored procedures - is this language a
> standard across DBMS? I'm not expecting this since most DBMS can't
> seem to follow SQL standards with simple things like dates or
> wild-cards.

Oracle's PLSQL is very similar; Interbase's procedural language is
similar, but requires some rewriting. MS Access doesn't have
procedural languages (you can use VBA in forms, reports, but not
table operations.) MySQL does not have at all.

Or, of course, you could use plperl or pltcl for your PG procedural
stuff; I doubt other databases offer these as PLs, but, the code
(w/modifications) could live outside the server in some cases.

> Another, more specific question: I'd like to know how to make two
> tables in PostgreSQL with a relationship between them so that when the
> parent row is removed from one table, its children in the other table
> will also be removed by PostgreSQL. I don't even know how to specify
> the foreign key. :) Conceptually I understand (I believe). I'm just no
> sure how to define this within PostgreSQL

CREATE TABLE parent (id INT PRIMARY KEY);
CREATE TABLE child (id REFERENCES parent ON DELETE CASCADE);

> I've done some searching through the on-line postgreSQL manual -
 in
> hopes to find a chapter in it akin to "referential integrity", but no
> such luck. Its possible I'm confusing the terminology.

I recently wrote a (draft) tutorial on referential integrity. If you go
to the PostgreSQL website & dig into the archives of the pgsql-doc
discussion list, you'll see it there from about 5 days ago.

--
Joel Burton, Director of Information Systems -*- jburton@scw.org
Support Center of Washington (www.scw.org)

pgsql-general by date:

Previous
From: Soma Interesting
Date:
Subject: RE: PL/pgSQL compatibility?
Next
From: "Tim Barnard"
Date:
Subject: Re: pgsql and C++ compiling question