X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 944D2D1B513 for ; Thu, 9 Oct 2003 18:58:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 95010-09 for ; Thu, 9 Oct 2003 15:58:05 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 59F63D1B4F9 for ; Thu, 9 Oct 2003 15:58:03 -0300 (ADT) Received: (qmail 14425 invoked by uid 500); 9 Oct 2003 19:05:36 -0000 Date: Thu, 9 Oct 2003 14:05:36 -0500 From: Bruno Wolff III To: Marek Lewczuk Cc: Lista dyskusyjna pgsql-sql , Lista dyskusyjna pgsql-general Subject: Re: [SQL] SQL query problem Message-ID: <20031009190536.GB14336@wolff.to> Mail-Followup-To: Marek Lewczuk , Lista dyskusyjna pgsql-sql , Lista dyskusyjna pgsql-general References: <003401c38e9e$f1e74b70$f16b4cd5@marek> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003401c38e9e$f1e74b70$f16b4cd5@marek> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/443 X-Sequence-Number: 50516 On Thu, Oct 09, 2003 at 20:52:58 +0100, Marek Lewczuk wrote: > Hello, > I'm in the middle of the migration process from MySQL to PostgreSQL and > I cannot understand why this query isn't working (in MySQL it's working > fine). PG returns: ERROR: Relation "_con" does not exist Probably you quoted the table name when you created it so that it is named _CON. However when you don't quote the name in later references _CON is converted to _con which is a different name that doesn't match any existing table. This behavior is contrary to the spec (lowercasing instead of uppercasing), but isn't going to change since uppercase names look ugly. A good general rule to follow is to either never quote names or always quote names. > > This is my query: > > SELECT > _CON.con_id, > _MOD.mod_ty, > _VER.version, > _YEA.year, > _CON.dri_id, > _CON.man_cod, > _ENG.eng_pow > FROM > db_data.mda_mod _MOD, > db_data.mda_mod_con _CON, > db_data.mda_mak_eng _ENG, > db_data.set_mda_fue _FUE > LEFT JOIN db_data.mda_mod_ver _VER ON _VER.ver_id = _CON.ver_id > LEFT JOIN db_data.mda_mod_yea _YEA ON _YEA.yea_id = _CON.yea_id > WHERE > _MOD.mod_id = '283' AND > _CON.mod_id = _MOD.mod_id AND > _CON.psd <= NOW() AND > _CON.ped > NOW() AND > _ENG.eng_id = _CON.eng_id AND > _ENG.eng_fue = _FUE.fue_id > > > I will be appreciated for you help. > > ML > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly