Re: [SQL] ERROR: UNIQUE constraint matching given keys for referenced table sequences not found

2001-07-17 Thread Richard Huxton
From: Dado Feigenblatt [EMAIL PROTECTED] I'm trying to create some tables with foreign keys. When I try to create a foreign key ... foreign key(seq_code) references sequences(seq_code) on update CASCADE on delete CASCADE, I get this message: ERROR: UNIQUE constraint

RE: [SQL] Re: drop table if exists

2001-07-17 Thread Maxim Maletsky
Alright, but what about when you're writing a long dump file with all these sequences, functions not speaking about the tables themselves. When I drop something I wanna make sure it out the database (but still cannot empty the whole database before), so I have DROP TABLE ..., ..., ..., ...;

Re: [SQL] Performance tuning in PostgreSQL?

2001-07-17 Thread Edipo Elder Fernandes de Melo
Em 10 Jul 2001, Raymond Chui escreveu: In other database systems, such as Informix, Sybase, etc. The database is stored in the raw disk partitions, you can config the database system into different partitions, different disks, slice into different trunks, etc. But PostgreSQL

[SQL] Select distinct and order by.

2001-07-17 Thread Carlos
Hi all: We have developed an aplication in C with postgresql, using libpq. Our version of development is Postgresql 6.5.3 and it works fine. Now we are migrating the application to various flavours of Linux (S.u.s.e 7.1, tha uses postgresql 7.0.3; Debian Potato, that uses postgresql 7.0.2) and

[SQL] How Postgresql Compares For Some Query Types

2001-07-17 Thread Mark kirkwood
Dear list, With the advent of Version 7.1.2 I thought it would be interesting to compare how Postgresql does a certain class of queries (Star Queries), and Data Loads with some of the other leading databases ( which were in my humble opinion Mysql 3.23.39, Db2 7.2 ,Oracle 9.0 [ ok - Possibly

Re: [SQL] Select distinct and order by.

2001-07-17 Thread Tod McQuillin
On Wed, 11 Jul 2001, Carlos wrote: Select distinct field1, field2 from table1 order by field3; The value return by PQresultErrorMessage is: For SELECT DISTINCT, ORDER BY expressions must appear in target list That's because this query is ambiguous. What if table1 looks like this: field1

[SQL] First steps in plpgsql - language not recognized?

2001-07-17 Thread Chris Ruprecht
Hi all, I have tried (and failed) my first steps in Pl/PgSQL. This must be real simple (like a 'create language' or something) but I don't (yet) know how to do this and maybe someone has a quick answer for me here. I get this (I'm sure it's a clear case of RT(F)M, but there are so many Ms to R,

[SQL] using custom column names in a group by clause

2001-07-17 Thread Matt Rinkenberger
The following select sets two custom column names using the same original column name. When I try to include a custom column name in a group by clause I get ORA-00904: invalid column name from Oracle. How can I access a column name I created in the group by clause? Here's the SQL: DISP is the

[SQL] No subselects in constraint (bug?)

2001-07-17 Thread Alexey V. Neyman
Hello there! [Please Cc: me in followups.] I tried the following: CREATE TABLE a ( int4 id ); CREATE TABLE b ( int4 id CHECK (id = ANY(SELECT a.id FROM a)) ); Tables are created ok, checking with '\d table' confirms it. But when I try to insert into table b, e.g.: INSERT INTO b (id)

[SQL] CAST(ipaddress as text) -- HOW?

2001-07-17 Thread Bhuvan A
hi all, how can we cast an ipaddress(type cidr) to any other type? thankx in advance.. Regards, Bhuvaneswar. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL

Re: [SQL] How Postgresql Compares For Some Query Types

2001-07-17 Thread Josh Berkus
Mark, (and Tom below) Thanks for doing the tests. These'll be useful to me if any client asks me again if PostgreSQL is a real database. I'm particularly intrigued that MySQL performed so poorly. In the field, it's been quite speedy but maybe that's because applications using it are

Re: [SQL] First steps in plpgsql - language not recognized?

2001-07-17 Thread Peter Eisentraut
man createlang -- Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/~peter ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Select distinct and order by.

2001-07-17 Thread Tom Lane
Carlos [EMAIL PROTECTED] writes: Select distinct field1, field2 from table1 order by field3; The value return by PQresultErrorMessage is: For SELECT DISTINCT, ORDER BY expressions must appear in target list Whatever this query works fine in postgresql 6.5.3. Is correct this query and so

RE: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Robby Slaughter
The hack and slash Perl programmer in me says--- if you only plan to do this once, (like importing data), then just write a Perl script that *generates* SQL code that does your inserts, updates, or whatever. You can then execute thsi with psql -f filename. But if you're trying to use flat files

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Wei Weng
You can probably try to make a c extension that does open/close. On 17 Jul 2001 15:28:36 -0500, Chris Ruprecht wrote: Hi all, I need to know how I can access a flat file from within a PL/PGSQL script. I have an Oracle PL/SQL book here and they refer to FOPEN(...), FCLOSE(...) but these

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Tom Lane
Chris Ruprecht [EMAIL PROTECTED] writes: I need to know how I can access a flat file from within a PL/PGSQL script. You can't --- and you should ask yourself hard questions about why your system design needs that, or whether the data in question shouldn't be inside the database to begin with.

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ...:)

2001-07-17 Thread Chris Ruprecht
Hi Tom, If life was easy, everything would just come in the format I'd like it. But since it isn't, I need to create records like this one: cdate| ctime | countrycode | areacodex | success | carrier | duration| phonenumber | areacode | pseq | loadno | frline | entity | loaddate |

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Tom Lane
Chris Ruprecht [EMAIL PROTECTED] writes: If life was easy, everything would just come in the format I'd like it. But since it isn't, I need to create records like this one: ... From an input file where the records looks like this one: If it's just a data import issue, why do you want to do

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Josh Berkus
Chris, Hmmph. People are in a bad mood this week; obviously few other people on the list have had to write applications for the banking industry, which trades everything in flat files. Give Chris a break! From an input file where the records looks like this one: 020-13 016-05 07-15-2001

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ...:)

2001-07-17 Thread Chris Ruprecht
Hi Josh, on 07/17/2001 18:31, Josh Berkus at [EMAIL PROTECTED] wrote: Chris, Hmmph. People are in a bad mood this week; obviously few other people on the list have had to write applications for the banking industry, which trades everything in flat files. Give Chris a break! Thanks

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Josh Berkus
Crhis, Thanks ;). I'm new to PostGreSQL and to PHP and to SQL - I have done Progress RDBMS/4GL for the last 12 years and it absolutely spoils you. But in the last 2 weeks, I have hammered out an application (you can have a look at http://chill-025.bbnow.net, use user demo and password

[SQL] Re: [GENERAL] trigger on DELETE

2001-07-17 Thread Thalis A. Kalfigopoulos
On Wed, 11 Jul 2001, Stephan Szabo wrote: On Wed, 11 Jul 2001, Phuong Ma wrote: I'm trying to define a trigger that copies the row to be deleted into another table (which is the inventory_audit table) before it does the delete from the original table (which is the inventory table).

[SQL] Why lost all foreign key constraits after cluster?

2001-07-17 Thread Raymond Chui
After I performed cluster indexname on tablename; All the foreign key constraints are lost on that table, why is that? I get messages like NOTICE: DROP TABLE implicitly drops referential integrity trigger from table tablename during cluster I don't want to lost the foreign key constraints