[SQL] very frustrating feature-bug

2010-02-16 Thread silly sad
acc=> CREATE OR REPLACE FUNCTION add_user (TEXT, TEXT, TEXT, TEXT) RETURNS usr AS $$ INSERT INTO usr (login,pass,name,email) VALUES ($1,$2,$3,$4) RETURNING usr.*; $$ LANGUAGE sql SECURITY DEFINER; acc=> ERROR: return type mismatch in function declared to return usr DETAIL: Function's fin

Re: [SQL] UNION or LEFT JOIN?

2010-02-16 Thread Louis-David Mitterrand
On Tue, Feb 16, 2010 at 09:38:19PM +, Tim Landscheidt wrote: > Louis-David Mitterrand wrote: > > > Here is the basic schema: > > > -->id_ship>--- > > || > > [SHIP]->id_ship->[CABIN]->id_ca

Re: [SQL] UNION or LEFT JOIN?

2010-02-16 Thread Tim Landscheidt
Louis-David Mitterrand wrote: > Here is the basic schema: > -->id_ship>--- > || > [SHIP]->id_ship->[CABIN]->id_cabin->[PRICE]<-id_cruise<-[CRUISE] > It's a database of cruise prices. > Each

Re: [SQL] UNION or LEFT JOIN?

2010-02-16 Thread Louis-David Mitterrand
On Tue, Feb 16, 2010 at 03:33:23PM +, Oliveiros wrote: > Louis-David, > > Please advice me, Hi Oliveiros, > if some cabin doesn't have a price i.e. it is not available, is there some > way to tell > which cruise it belongs to? In fact a cabin belongs to a ship and CAN be associated to a 'cr

Re: [SQL] UNION or LEFT JOIN?

2010-02-16 Thread Oliveiros
Louis-David, Please advice me, if some cabin doesn't have a price i.e. it is not available, is there some way to tell which cruise it belongs to? You have PRICE table which seems to me to be an associative table between cruise and cabin, is this correct? But, if the price doesn't have a registe

[SQL] UNION or LEFT JOIN?

2010-02-16 Thread Louis-David Mitterrand
Here is the basic schema: -->id_ship>--- || [SHIP]->id_ship->[CABIN]->id_cabin->[PRICE]<-id_cruise<-[CRUISE] It's a database of cruise prices. Each 'price' object has a reference to 'cabin' an