Re: [SQL] Getting FK relationships from information_schema

2004-06-09 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> We have discussed changing the default names of FK constraints >> before. I have no problem with doing something like the above --- any >> objection out there? > I think it's a good idea. It will also make the error messages of the

Re: [SQL] What's wrong with my date/interval arithmetic?

2004-06-09 Thread Tom Lane
Wojtek <[EMAIL PROTECTED]> writes: > Investigating that a little further I found out that there is a difference > in results returned by age: > select age(cast(to_timestamp('2003-12-01 03:50:45','-MM-dd HH24:MI:SS') as > timestamp), > cast(to_timestamp('2003-10-17 23:07:00','

Re: [SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-09 Thread Tom Lane
Chris Gamache <[EMAIL PROTECTED]> writes: > I'm having a heck of a time, and it seems like in my thrashing about > to find a solution to this problem I have ruined the uniqueidentifier > datatype in the schema... > CREATE INDEX mt_uuid_idx > ON my_schema.my_table USING btree (my_uuid); > ERROR:

Re: [SQL] returning a recordset from PLpg/SQL

2004-06-09 Thread Terence Kearns
Stephan Szabo wrote: As a starting point, SETOF "RECORD" is different from SETOF RECORD given PostgreSQL's fold case to lower case for unquoted names. Ahh! That will help :) That's what you get when you use a silly IDE instead of a regular editor like vi or notepad or something. Because I haven't

Re: [SQL] Trigger problem

2004-06-09 Thread Jan Wieck
On 6/8/2004 2:57 PM, Mike Rylander wrote: kasper wrote: Hi guys Im tryint to make a trigger that marks a tuble as changed whenever someone has updated it my table looks something like this create table myTable ( ... changed boolean; ) now ive been working on a trigger and a sp that looks li

Re: [SQL] Trigger problem

2004-06-09 Thread Stephan Szabo
On Tue, 8 Jun 2004, kasper wrote: > Im tryint to make a trigger that marks a tuble as changed whenever someone > has updated it > > my table looks something like this > > create table myTable ( > ... > changed boolean; > ) > > now ive been working on a trigger and a sp that looks like thi

Re: [SQL] Trigger problem

2004-06-09 Thread Mike Rylander
kasper wrote: > Hi guys > > Im tryint to make a trigger that marks a tuble as changed whenever someone > has updated it > > my table looks something like this > > create table myTable ( > ... > changed boolean; > ) > > now ive been working on a trigger and a sp that looks like this, bu

[SQL] Trigger problem

2004-06-09 Thread kasper
Hi guys Im tryint to make a trigger that marks a tuble as changed whenever someone has updated it my table looks something like this create table myTable ( ... changed boolean; ) now ive been working on a trigger and a sp that looks like this, but it doesnt work... create function myFu

[SQL] search and replace

2004-06-09 Thread Jodi Kanter
I have a field in one of my tables that has a path to a file listed. I need to move those files and now have to update all those paths. Is there a simply search and replace type option in sql? or do I need to do an update using the entire new path name? If so, I think the easier solution will b

[SQL] Schema + User-Defined Data Type Indexing problems...

2004-06-09 Thread Chris Gamache
PostgreSQL 7.4.2 -- All vacuumed and analyzed. I inserted the uniqueidentifier datatype into a new schema that I'm working on by changing the search_path to "my_schema" in the contrib SQL. It effectively created the datatype within the schema, all of its functions, operators, and operator classes.

Re: [SQL] Triggers

2004-06-09 Thread Richard Huxton
Philip J. Boonzaaier wrote: The technical reference gives an example of a trigger on a table - employee Just to test this, I have created the following table, CREATE TABLE employee (name VARCHAR(30), age int4, state VARCHAR(2), manager VARCHAR(3), adult VARCHAR(3)); The I created a simple Functio

Re: [SQL] returning a recordset from PLpg/SQL

2004-06-09 Thread Richard Huxton
Terence Kearns wrote: Looking at the datatypes you can RETURN, it doesn't seem that there is a way to return a recordset I tried RETURNS SETOF RECORD but that doesn't work I even tried RETURNS SETOF fooTable%ROWTYPE What I would like to do is not that simple, I need to be able to build/declare a

Re: [SQL] Last insert id

2004-06-09 Thread Richard Huxton
mixo wrote: I have three tables which are related a serial field, table1_id, in on of the tables. Updating the tables is done through a transaction. My problem is, once I have insert a row in the first tables with table1_id, I need for the other two tables. How can I get this? Is it safe to us

Re: [SQL] Last insert id

2004-06-09 Thread mkl
I'm new on postgreSQL, so this might not be the simplest sollution: Use a sequence instead of serial. After you have generated the new id with your_seq.nextval you can get thesame number again with your_seq.currval. details at http://www.postgresql.org/docs/7.3/static/functions-sequence.html mi