You can have foreign keys between temp tables, just not between temp and permanent tables. The latter case is either fairly silly, or technically hard, depending on which direction you have in mind.
A temp table referencing a permanent table wouldn't be very silly IMHO... Sander. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match