|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22204 DB tableInfo(): table set where it should not be
Submitted: 2003-02-13 07:04 UTC Modified: 2003-05-05 10:22 UTC
From: marc at links2linux dot de Assigned: ssb (profile)
Status: Closed Package: PEAR related
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
18 + 18 = ?
Subscribe to this entry?

 [2003-02-13 07:04 UTC] marc at links2linux dot de

I use the PEAR DB tableInfo() funtion to get information about table fields (mysql).

if you say "SELECT id FROM table1 ..." then the table attribute for id is set to "table1". Thats correct because I can use "" to refer to that field in a WHERE clause for example.

If I use something like SELECT CONCAT(anschr_1, ' - ',
                                 IFNULL(anschr_2,''), ' - ',
                          AS customer_name FROM table1

then the table attribute is *not* set. That very OK because the field table1.customer_name does not exist.

Now the problem:
If I say "SELECT AS id2 , FROM table1, table2 ..." then the "table" attribute of "id2" in tableInfo() is set to "table1" which is IMHO *not* OK because table1.id2 is not a valid field.

I hope It's clear what I am pointing to...



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-28 03:59 UTC]
changing status
 [2003-05-04 11:40 UTC]
there isnt much we can do here since the mysql API does not give us this sort of infos (doubt other APIs do). So I guess all we can do is document this.
 [2003-05-05 08:15 UTC]
actually let me clarify:
if you pass a result to tableinfo then you are getting infos on the "structure" of the result set.

If you are interested in getting information on the structure of the table dont pass it a resultset but the name of the table you are interested in.
 [2003-05-05 10:22 UTC] marc at links2linux dot de
Yes, but in my case I am in a generic class that handles  
many different queries and the query can be set  
dynamically so I cannot know the tables that are in use.  
I think if the API is the showstopper here, a little note  
in the docs would be very good.  
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 22:03:34 2021 UTC