[SQL] Foreign Key between different databases

2001-04-10 Thread Stan van de Mortel
Hello, I've a table in a database and I want to create a column that is a foreign key to a table in an other database. When I try ...,foreign key (x) references otherdb.table(x) it says 'parse error at or near "."'. Is there an other way to create this kind of foreign key? Stan van de Mortel [[

[SQL] Re: [GENERAL] install pgSQL 7.1

2001-04-10 Thread datactrl
No, I'm still at sea. Please help ! JACK - Original Message - From: "Justin Clift" <[EMAIL PROTECTED]> To: "datactrl" <[EMAIL PROTECTED]> Sent: Tuesday, April 10, 2001 3:18 AM Subject: Re: [GENERAL] install pgSQL 7.1 > Hi, > > Have people answered you regarding this? > > Regards and

[SQL] RE: Re: select substr???

2001-04-10 Thread Jeff Eckermann
And if you have plperl installed, something like this is even easier: create function texttrim(text) returns text as '$_[0] =~ s/\\W//g; return $_[0]' language 'plperl'; (I just read the docs) :-) > -Original Message- > From: Jeff Eckermann [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, April

[SQL] RE: Re: select substr???

2001-04-10 Thread Jeff Eckermann
Regular expressions make this much easier. The below could be shortened to: create function ComparisonString(text) returns text as ' declare t alias for $1; r text; c char; begin if t is null or t !~ ''[^a-zA-Z0-9

Re: [SQL] a select statement that sometimes joins

2001-04-10 Thread Oliver Elphick
Mark Stosberg wrote: > > > >Here's a situation I've run into more than once with SQL: > >I want to select all the rows in a table that match a criteria, where one >of the criteria is possibly having a related entry in a second table. For >my example, lets say I have table named 'me

Re: [SQL] Re: select substr???

2001-04-10 Thread Albert REINER
On Mon, Apr 09, 2001 at 06:05:55PM +0100, Tim Johnson wrote: > Hi, > > I have postgres 6.x (where x is something). > > I have the following list of data > > data > > ABC* > ABC > ABC- ... > what I want to do is 'select distinct(data) [ignoring non alphanumeric > characters] order by da

Re: [SQL] Re: \i command

2001-04-10 Thread Najm Hashmi
Joel Burton wrote: > On Wed, 11 Apr 2001, Najm Hashmi wrote: > > > Hi All, > > From pgsql, I try to insert data in table using the \i command. Nothing > > takes place and after this command pgsql is hung... i cant use it any more. > > The same command works with all other tables but this is o

[SQL] a select statement that sometimes joins

2001-04-10 Thread Mark Stosberg
Here's a situation I've run into more than once with SQL: I want to select all the rows in a table that match a criteria, where one of the criteria is possibly having a related entry in a second table. For my example, lets say I have table named 'messages' and another named 'message_attachment

Re: [SQL] Re: \i command

2001-04-10 Thread Joel Burton
On Wed, 11 Apr 2001, Najm Hashmi wrote: > Joel Burton wrote: > > > On Wed, 11 Apr 2001, Najm Hashmi wrote: > > > > > From pgsql, I try to insert data in table using the \i command. Nothing > > > takes place and after this command pgsql is hung... i cant use it any more. > > > The same comman

[SQL] Re: \i command

2001-04-10 Thread Joel Burton
On Wed, 11 Apr 2001, Najm Hashmi wrote: > Hi All, > From pgsql, I try to insert data in table using the \i command. Nothing > takes place and after this command pgsql is hung... i cant use it any more. > The same command works with all other tables but this is only one I am having > problem w

[SQL] Semantics of Typed Numeric Constants

2001-04-10 Thread Mark Butler
Thomas Lockhart wrote in comp.databases.postgresql.hackers: > The parser does not know that your int4 constant "0" can be represented > as an int2. Try > > SELECT * FROM access_log WHERE method_num = int2 '0'; > > (note the type coersion on the constant; there are other ways of > specifying t

Re: [SQL] Sorting and then...

2001-04-10 Thread Jason Earl
SELECT name FROM test ORDER BY id DESC LIMIT 10; Take care, Jason --- Wei Weng <[EMAIL PROTECTED]> wrote: > Suppose I have a table > > create table test > ( > id integer, > name text > ); > > And I want to get the names of the largest 10 "id"s. > How can I do that in > sql?

[SQL] \i command

2001-04-10 Thread Najm Hashmi
Hi All, From pgsql, I try to insert data in table using the \i command. Nothing takes place and after this command pgsql is hung... i cant use it any more. The same command works with all other tables but this is only one I am having problem with. I have attached my file with message. Could so

[HACKERS] Re: problem with copy command

2001-04-10 Thread Joel Burton
On Tue, 10 Apr 2001, Jaruwan Laongmal wrote: > dear all, > I currently using postgresql v7.0.3 > when i import text file to table with command "copy tablename from > '/tmp/a.txt'; > and it shows > "copy: line 20, Cannot insert a duplicate key into unique index testpri_pk" > ,then it exits with do

Re: [SQL] Copying null values

2001-04-10 Thread Christof Glaser
On Tuesday, 10. April 2001 14:17, Amanda Riera wrote: > I would like empty fields from a file being recognised as NULL > values. It doesn't seem to work when a COPY is done, but when I make > an INSERT without > specifying the value, this is recognised as a NULL > > The file I want to copy is: > >

[SQL] The Momjian Tome / DBA Certification

2001-04-10 Thread Thomas Good
Hey Bruce, Your book finally hit the bookshelves of Staten Island. We have a Barnes and Noble here that actually has a reasonable database section although it is misnamed 'Networking'. ;-) I'll be getting my copy on payday - I found the sql examples that I downloaded very useful and as I've been

[SQL] Copying null values

2001-04-10 Thread Amanda Riera
Hi all, I am using: Debian 2.2 (kernel 2.2.18) PgSQL version 7.0.3 I would like empty fields from a file being recognised as NULL values. It doesn't seem to work when a COPY is done, but when I make an INSERT without specifying the value, this is recognised as a NULL The file I want to copy is

RE: [SQL] Sorting and then...

2001-04-10 Thread Michael Ansley
Title: RE: [SQL] Sorting and then... But if you want the largest 10, then you can: SELECT name FROM ORDER BY id DESC LIMIT 10; assuming that you mean largest numerically. Cheers... MikeA >> -Original Message- >> From: Roberto Mello [mailto:[EMAIL PROTECTED]] >> Sent: 10 A

[HACKERS] problem with copy command

2001-04-10 Thread Jaruwan Laongmal
dear all, I currently using postgresql v7.0.3 when i import text file to table with command "copy tablename from '/tmp/a.txt'; and it shows "copy: line 20, Cannot insert a duplicate key into unique index testpri_pk" ,then it exits with doing nothing. I want to ignore this errors and continue copy