LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2001, 05:20 AM   #1
Bert
Senior Member
 
Registered: Jul 2001
Location: 406292E 290755N
Distribution: GNU/Linux Slackware 8.1, Redhat 8.0, LFS 4.0
Posts: 1,004

Rep: Reputation: 46
Fascinating PostgreSQL foreign keys problem


I've made up some foreign keyed tables referring to a to table with only one primary key (a unique membership number).

I've populated the first table but it won't let me populate the foreign-keyed tables - (with the matching data of course).

Does anyone know why? SQL books and the PostgreSQL tutorial certainly don't!

thanks

Bert
 
Old 12-11-2001, 07:08 AM   #2
Bert
Senior Member
 
Registered: Jul 2001
Location: 406292E 290755N
Distribution: GNU/Linux Slackware 8.1, Redhat 8.0, LFS 4.0
Posts: 1,004

Original Poster
Rep: Reputation: 46
Whoever named SQL 'Structured Query Language' must have been joking. It is without a doubt the most unstructured joke of a language I've ever come across!

The solution to the problem above is this:

1. Make your tables, with primary keys.
2. do an
ALTER TABLE myTable ADD FOREIGN KEY FKey1 REFERENCES myOtherTable

before you INSERT into the tables.

In other words, make the table then change it to do something you should be able to do first time round but can't.

Another way is to insert ALL of the attributes into a HUGE parent table and foreign key everything from that!

Normalisation? Database efficiency? Hey who needs it when you have UQL - Unstructured Query Language!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Utterly fascinating boot sector problem: "Differences: (offset:original/backup)" Bert Linux - Software 4 07-01-2013 05:29 PM
Postgresql Problem mitrship Programming 3 07-28-2005 12:09 AM
Problem with PostgreSQL !!! beyond_2000 Linux - Software 10 06-15-2004 06:46 AM
Postgresql problem BobNz Linux - Software 11 05-02-2004 02:43 PM
postgresql -odbc & postgresql-jdbc installation kjsubbu Linux - Software 0 06-19-2003 02:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration