473,473 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SQL query problem

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

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 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
2 1255
On Thu, Oct 09, 2003 at 20:52:58 +0100,
Marek Lewczuk <ne***@lewczuk.com> 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 ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2
> fine). PG returns: ERROR: Relation "_con" does not exist

This is my query:

SELECT
_CON.con_id,

Please make sure you get the quoting right regarding table
names. PostgreSQL will fold _CON into _con unless quoted
"_CON". So, it may be that you created the table with quotes
("_CON"). Now, in your query you don't use quotes and thusly
it is looking for a _con table. The simple rule of thumb is to
either always or never use quotes.

HTH,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
3
by: Brian Oster | last post by:
After applying security patch MS03-031 (Sql server ver 8.00.818) a query that used to execute in under 2 seconds, now takes over 8 Minutes to complete. Any ideas on what the heck might be going...
1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
8
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
11
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive...
4
by: Konrad Hammerer | last post by:
Hi! I have the following problem: I have a query (a) using another query (b) to get the amount of records of this other query (b), means: select count(MNR) as Number from...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.