Unix Technical Forum

BUG #2501: JOIN and capitial letters in Table Row

This is a discussion on BUG #2501: JOIN and capitial letters in Table Row within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2501 Logged by: ALL Email address: thegreatall@gmail.com PostgreSQL version: 8.1 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 11:05 AM
ALL
 
Posts: n/a
Default BUG #2501: JOIN and capitial letters in Table Row


The following bug has been logged online:

Bug reference: 2501
Logged by: ALL
Email address: thegreatall@gmail.com
PostgreSQL version: 8.1
Operating system: Windows
Description: JOIN and capitial letters in Table Row
Details:

I had a table as like the following named products:

id ClientID ProductID is_multiqty is_active
1 12345 1000001 1 1
2 12345 1000002 0 1

and another table named productoptions with the following:

id ProductID Sku Description OptionID minpayments maxpayments maxqty is_acti
ve
1 1000001 somedesc1 1 1 1 0 1
1 1000002 CX7535 somedesc2 1 1 3 0 1

when I ran the following sql I got: ""ERROR: column product.ProductID does
not exist":

SELECT *
FROM products
JOIN productoptions
ON products.ProductID = productoptions.ProductID

However, if i changed the name of the fields in the database to:

"productid"

It would work fine.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 11:05 AM
Jim C. Nasby
 
Posts: n/a
Default Re: BUG #2501: JOIN and capitial letters in Table Row

If you define an object using quotes to preserve case, you must always
refer to that object with quotes, ie: productoptions."ProductID".

My recommendation: use underscores in the database
(product_options.product_id). Personally, I wouldn't pluralize the
table names either, but that's just me...

On Wed, Jun 28, 2006 at 03:13:28AM +0000, ALL wrote:
>
> The following bug has been logged online:
>
> Bug reference: 2501
> Logged by: ALL
> Email address: thegreatall@gmail.com
> PostgreSQL version: 8.1
> Operating system: Windows
> Description: JOIN and capitial letters in Table Row
> Details:
>
> I had a table as like the following named products:
>
> id ClientID ProductID is_multiqty is_active
> 1 12345 1000001 1 1
> 2 12345 1000002 0 1
>
> and another table named productoptions with the following:
>
> id ProductID Sku Description OptionID minpayments maxpayments maxqty is_acti
> ve
> 1 1000001 somedesc1 1 1 1 0 1
> 1 1000002 CX7535 somedesc2 1 1 3 0 1
>
> when I ran the following sql I got: ""ERROR: column product.ProductID does
> not exist":
>
> SELECT *
> FROM products
> JOIN productoptions
> ON products.ProductID = productoptions.ProductID
>
> However, if i changed the name of the fields in the database to:
>
> "productid"
>
> It would work fine.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

---------------------------(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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com