Re: [GENERAL] Normal vs Surrogate Primary Keys...

2006-10-04 Thread rlee0001
Martijn van Oosterhout wrote: > On Sun, Oct 01, 2006 at 07:48:14PM -0700, rlee0001 wrote: > > For example, if I key "employee" by Last Name, First Name, Date > > of Hire and Department, I would need to store copies of all this data > > in any entity that relat

Re: [GENERAL] Normal vs Surrogate Primary Keys...

2006-10-02 Thread rlee0001
Tom Lane wrote: > "rlee0001" <[EMAIL PROTECTED]> writes: > > ... I know, for example, that by default PostgreSQL assigns every record a > > small unique identifier called an OID. > > Well, actually, that hasn't been the default for some time, and ev

Re: [GENERAL] Normal vs Surrogate Primary Keys...

2006-10-02 Thread rlee0001
Stephan Szabo wrote: > On Sun, 1 Oct 2006, rlee0001 wrote: > > > I know, for example, that by default PostgreSQL assigns every record a > > small unique identifier called an OID. It seems reasonable then, that > > when the DBA creates a cascading foreign key to a record,

[GENERAL] Normal vs Surrogate Primary Keys...

2006-10-01 Thread rlee0001
I know this is an old topic and also a religious one so I won't get into the debate, but I thought up one possible solution that would make almost everybody happy and was wondering if any PostgreSQL hackers out there had any thoughts. I was wondering if, considering that an entity can only have a

Re: [GENERAL] Regex

2006-02-06 Thread rlee0001
If your version does not support regexp_replace(), I have written a similar function for easlier versions of postgresql using pl/pgsql called regexp_replacex(). You can find it by searching google groups. As the thread there points out, the function I wrote doesn't treat NULLs properly as posted an

Re: [GENERAL] 8.0.3 regexp_replace()...

2006-02-02 Thread rlee0001
Stephan, How do IN and NOT IN treat NULLs? Don't these functions search an array for a specified value returning true or false? I guess the intuitive thing for IN and NOT IN to do would be to return NULL if NULL appears anywhere in the array since those elements values are "unknown". Personally I

Re: [GENERAL] 8.0.3 regexp_replace()...

2006-02-01 Thread rlee0001
Martijn, (Warning: This post contains somewhat of a long rant followed by a question.) I realize that NULL is the unknown value in SQL and that (most) functions therefore treat it as such. I have no problem with "RETURNS NULL ON NULL INPUT" except when a function returns NULL for no good reason.

Re: [GENERAL] 8.0.3 regexp_replace()...

2006-01-31 Thread rlee0001
I did get the code working. The function DDL follows: CREATE OR REPLACE FUNCTION "webadmin"."regexp_replacex" (source varchar, pattern varchar, replacement varchar) RETURNS varchar AS $body$ DECLARE retvalue VARCHAR; BEGIN retvalue = "source"; LOOP retvalue = REPLACE(retvalue, COALESCE(SUBSTR

[GENERAL] 8.0.3 regexp_replace()...

2006-01-31 Thread rlee0001
I have a stupid problem. My server is running an old version of postgres (8.0.3) and therefore lacks the regexp_replace() function. It does however support substring and replace functions. So what I am trying to do is emulate the regexp_replace() function by creating a function which finds each mat

Re: [GENERAL] Little Offtopic: Database frontends

2006-01-31 Thread rlee0001
EMS PostgreSQL Manager for Windows (Commercial) Actually its all I've ever used for postgres but it works well. Could be better. -Robert ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresq

Re: [GENERAL] PostgreSQL Top 10 Wishlist

2006-01-14 Thread rlee0001
Martijn van Oosterhout wrote: > On Thu, Jan 12, 2006 at 08:51:44PM -0800, rlee0001 wrote: > > 1. > > Two new special variables in triggers functions (TG_STATEMENT and > > TG_EFFECTIVE_STATEMENT) which returns the statement that triggered the > > trigger. > > W

[GENERAL] PostgreSQL Top 10 Wishlist

2006-01-13 Thread rlee0001
I've been using PostgreSQL 8.1 with EMS PostgreSQL Manager and PHP for about a month now and here are the top 10 features I'd like to see. Keep in mind that I'm a novice so we might have some of this and I just can't find it in the docs. 1. Two new special variables in triggers functions (TG_STATE

Re: [GENERAL] Returning SQL statement

2006-01-13 Thread rlee0001
Thanks guys but I cannot use C on the database server. I am a lowly coder in a large organization and even getting pl/PGSQL loaded into the production database practically took an act of congress. So for now solutions that require stored procedures to be written in C are not an option. pl/Perl wou

[GENERAL] Returning SQL statement

2006-01-12 Thread rlee0001
I want to write a row-level trigger in PL/PGSQL that inserts rows into an audit log whenever records are UPDATEd for a specific table. In my audit log I want to record: * The primary key of the record being modified (easy) * The current date (easy) * The username of the user (easy) * The SQL state