Re: [SQL] Cross-table constraints

2003-01-29 Thread Rodger Donaldson
On Tue, 28 Jan 2003, Rodger Donaldson wrote: Now, adding a UNIQUE constraint on the pk for add_queue weeds out dupes there. However, attempting to add a cross-table UNIQUE check with: alter table add_queue add constraint add_queue_no_dupe_sites unique (sites.url); ERROR: parser:

Re: [SQL] Creating tables from within functions

2003-01-29 Thread Stephan Szabo
On Fri, 24 Jan 2003, Seethalakshmi VB wrote: Is it possible to issue a CREATE TABLE statement from inside of a PostgreSQL function? If not, then how about from within a PL/pgSQL function? I have tried a lot of different permutations but can't seem to get it to compile and/or run cleanly.

[SQL] USING INDEX

2003-01-29 Thread Abdul Wahab Dahalan
How do we determine which column/s to be set when creating an INDEX? As I understand, using INDEX the query will be more faster then without using INDEX. How about using INDEX if query is a JOIN query, which involved 4 tables. ---(end of

Re: [SQL] Cross-table constraints

2003-01-29 Thread Bruno Wolff III
On Tue, Jan 28, 2003 at 20:05:15 +1300, Rodger Donaldson [EMAIL PROTECTED] wrote: The problem: I have two tables, add_queue and sites, on a postgresql 7.2.x database. add_queue is where items go to be reviewed by a human before being moved into sites. One of the things I'd like to do is

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-29 Thread David Durst
David Durst [EMAIL PROTECTED] writes: insert into journal_lines (entry_id,account_id,line_type,line_amount) values (eid,aid,ltype,amount); select into line * from journal_lines where entry_id = eid AND account_id = aid AND ltype = ltype; I bet that last should be line_type = ltype?

Re: [SQL] converting microsoft sql server 2000 sql-code for postgresql

2003-01-29 Thread Bruno Wolff III
On Tue, Jan 28, 2003 at 23:39:47 -0500, Wei Weng [EMAIL PROTECTED] wrote: What about a UNIQUEIDENTIFIER type? You probably want to use serial type as a replacement. Serial is really int with a default obtained using a sequence. ---(end of

Re: [SQL] Filter function

2003-01-29 Thread Tom Lane
Evgen Potemkin [EMAIL PROTECTED] writes: term2=select * from tab where tab=1; ERROR: exprType: Do not know how to get type for 711 node What release is this? I get Relation reference tab cannot be used in an expression in 7.3 and CVS tip, and Attribute 'tab' not found in prior

Re: [SQL] LONG - Question on dealing w/ numerics

2003-01-29 Thread Tom Lane
David Durst [EMAIL PROTECTED] writes: But I still think your point about the function selecting more than one line is valid. The problem is, the journal_line_id is not created until the insert occurs and there is no other unique ident than the journal_line_id. Well, my standard answer to

[SQL] plpgsql: return results of a dynamic query

2003-01-29 Thread Moritz Lennert
Hello, I'am a complete newbie to plpgsql, so if this information is explained somewhere where I haven't looked, yet, please point me to the doc... (I didn't find the answer in the PostgreSQL Programmer's Guide.) I use PG 7.3.1. I'm trying to retrieve a row count from several tables (40) and

Re: [SQL] CSV import

2003-01-29 Thread Gary Stainburn
On Wednesday 29 January 2003 5:50 am, Oliver Vecernik wrote: Oliver Vecernik schrieb: Hi again! After investigating a little bit further my CSV import couldn't work because of following reasons: 1. CSV files are delimited with CR/LF 2. text fields are surrounded by double quotes

Re: [SQL] plpgsql: return results of a dynamic query

2003-01-29 Thread Christoph Haller
I'm trying to retrieve a row count from several tables (40) and would like to create a function that does this automatically for the 40 and displays the results. So, I loop through the tables: DECLARE obj RECORD; BEGIN FOR obj IN SELECT relname AS name FROM pg_class

Re: [SQL] plpgsql: return results of a dynamic query

2003-01-29 Thread Moritz Lennert
I'm trying to retrieve a row count from several tables (40) and would like to create a function that does this automatically for the 40 and displays the results. So, I loop through the tables: DECLARE obj RECORD; BEGIN FOR obj IN SELECT relname AS name FROM pg_class

[SQL] help: triggers

2003-01-29 Thread Tony Simbine
hello, I'm trying to update a columm on a table with a trigger but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC 2.96). when I update a row the trigger does nothing. what can I do? thanks in advance tony here is my trigger:

Re: [SQL] help: triggers

2003-01-29 Thread Wei Weng
It would be better if you could provide the source of that trigger and involved table schemas? Wei - Original Message - From: Tony Simbine [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 8:29 AM Subject: [SQL] help: triggers hello, I'm trying to update a

[SQL] Inheritence and Integrity

2003-01-29 Thread Neal Lindsay
I am creating a database that will keep track of several different types of 'events'. I am toying with the idea of making a base 'class' table for the tables because a lot of the information will be the same (also there will probably be times I just need to get the basic information about

Re: [SQL] Inheritence and Integrity

2003-01-29 Thread Stephan Szabo
On Wed, 29 Jan 2003, Neal Lindsay wrote: I am creating a database that will keep track of several different types of 'events'. I am toying with the idea of making a base 'class' table for the tables because a lot of the information will be the same (also there will probably be times I just

Re: [SQL] Inheritence and Integrity

2003-01-29 Thread Neal Lindsay
Stephan Szabo wrote: On Wed, 29 Jan 2003, Neal Lindsay wrote: I am creating a database that will keep track of several different types of 'events'. I am toying with the idea of making a base 'class' table for the tables because a lot of the information will be the same (also there will probably

Re: [SQL] Inheritence and Integrity

2003-01-29 Thread chester c young
inheriting pk and triggers pg inheritance is quite limited. what i (and i'm sure many others) have done is: 1. create master sequence 2. create base table 3. create base trigger procedures 4. create derived tables, using inherit 5. write procedure p( table_name ) that a) sets pk of table_name

Re: [SQL] [HACKERS] Please include hier-patch in next PostgreSQL version

2003-01-29 Thread Rod Taylor
On Mon, 2003-01-27 at 10:05, Boris Klug wrote: Hello! I want to say that it would be fantastic when you include the Oracle like CONNECT BY patch (see gppl.terminal.ru/readme.html) in the next version of PostgreSQL. It is very usefull for people that have to handle such kind of