Re: [SQL] Quick question re foreign keys.

2007-10-24 Thread D'Arcy J.M. Cain
On Wed, 24 Oct 2007 09:43:10 +0200 Nis Jørgensen <[EMAIL PROTECTED]> wrote: > Well, I have a couple of times had the "need" to have a primary > key/uniqueness constraint with one column nullable (indicating "Not > Applicable"). The "problem" is that we have only one NULL, which for > comparison pur

Re: [SQL] Quick question re foreign keys.

2007-10-24 Thread Robins Tharakan
Forgive my butting in, but frankly, most of the times, whenever I find myself in a very 'exceptional problem' such as this one, I always end up questioning the basic design due to which I am stuck in the first place. Paul, it seems that probably there is a basic design issue here. All the best :)

Re: [SQL] Quick question re foreign keys.

2007-10-24 Thread Paul Lambert
Paul Lambert wrote: It's marked not null as a result of being part of the primary key for that table which I can't really get around. I can get away with not having the foreign key though, so I'll have to go down that path. Cheers, P. Ignore this whole thread actually. I need to rethin

Re: [SQL] Quick question re foreign keys.

2007-10-24 Thread Nis Jørgensen
D'Arcy J.M. Cain skrev: > On Wed, 24 Oct 2007 11:00:47 +0800 > Paul Lambert <[EMAIL PROTECTED]> wrote: >> It's marked not null as a result of being part of the primary key for >> that table which I can't really get around. >> >> I can get away with not having the foreign key though, so I'll have t

Re: [SQL] Quick question re foreign keys.

2007-10-23 Thread D'Arcy J.M. Cain
On Wed, 24 Oct 2007 11:00:47 +0800 Paul Lambert <[EMAIL PROTECTED]> wrote: > It's marked not null as a result of being part of the primary key for > that table which I can't really get around. > > I can get away with not having the foreign key though, so I'll have to > go down that path. It can

Re: [SQL] Quick question re foreign keys.

2007-10-23 Thread Paul Lambert
Tom Lane wrote: If I'm understanding you correctly, the problem is not the foreign key, it's that you marked the column NOT NULL. A foreign key constraint by itself will allow a NULL in the referencing column to pass. You choose whether you want to allow that or not by separately applying a NO

Re: [SQL] Quick question re foreign keys.

2007-10-23 Thread Tom Lane
Paul Lambert <[EMAIL PROTECTED]> writes: > I have a table where one column references by foreign key a column from > another table. However, the column in this first table does not always > contain data which results in a not-null constraint violation when I > attempt an insert. > My question t

Re: [SQL] Quick question re foreign keys.

2007-10-23 Thread Phillip Smith
> My question therefore is, is it possible to create a foreign key that is > conditional, i.e. only enforce the foreign key where the value in that > table is not null. My understanding from reading previous threads on this topic is the answer is no, however you could make your own pseudo-foreign

[SQL] Quick question re foreign keys.

2007-10-23 Thread Paul Lambert
I have a table where one column references by foreign key a column from another table. However, the column in this first table does not always contain data which results in a not-null constraint violation when I attempt an insert. My question therefore is, is it possible to create a foreign ke

[SQL] Quick Question

2002-07-14 Thread Christopher Kings-Lynne
How do you get this to work? I'm creating a view of a table, but I'm trying to do something like this: create table t ( id integer not null, amount numeric(7,2) ); create view v as select id as v_id, 'paid amount: ' || amount as v_comment from t ; You get this:

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-07 Thread Grigoriy G. Vovk
When I did the same task - I've writting a script on the perl, and if you have stable databese structure, I think, it's a best way - write a script which will run by cron /on-demand. Because, I don't remember exactly why (date format is different or something else) but, I couldn't move data from M

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread Bruce Momjian
> > > there is one in contrib > > as well there is some through freshmeat.net There are two in /contrib. One from pgsql.com, and another from freshmeat.net: http://ziet.zhitomir.ua/~fonin/code/ I would like to see these merged someday. -- Bruce Momjian|

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread dev
On 3/6/01, 5:26:18 PM, Josh Berkus <[EMAIL PROTECTED]> wrote regarding [SQL] Quick question MySQL --> PgSQL: > Folks, > Just a quick question ... I need to do a regular transfer (daily + on > demand) of data from a MySQL database to a PostgreSQL database and back >

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread clayton cottingham
"Brett W. McCoy" wrote: > > On Tue, 6 Mar 2001, Josh Berkus wrote: > > > Just a quick question ... I need to do a regular transfer (daily + on > > demand) of data from a MySQL database to a PostgreSQL database and back > > again. Can anybody steer me towards a good script for this, or do

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread The Hermit Hacker
v7.1's contrib directory has the mysql->pgsql script that was used for the SourceForge migration ... its also downloadable at http://www.pgsql.com->Downloads On Tue, 6 Mar 2001, Brett W. McCoy wrote: > On Tue, 6 Mar 2001, Josh Berkus wrote: > > > Just a quick question ... I need to do a r

Re: [SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread Brett W. McCoy
On Tue, 6 Mar 2001, Josh Berkus wrote: > Just a quick question ... I need to do a regular transfer (daily + on > demand) of data from a MySQL database to a PostgreSQL database and back > again. Can anybody steer me towards a good script for this, or do I > have to write my own in PHP? Don

[SQL] Quick question MySQL --> PgSQL

2001-03-06 Thread Josh Berkus
Folks, Just a quick question ... I need to do a regular transfer (daily + on demand) of data from a MySQL database to a PostgreSQL database and back again. Can anybody steer me towards a good script for this, or do I have to write my own in PHP? Sorry to bother everyone with som