|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27547 Sqlite column names change, but PRAGMA short_column_names=ON not working
Submitted: 2004-03-10 07:51 UTC Modified: 2004-03-10 09:23 UTC
From: col at mportal dot hu Assigned:
Status: Not a bug Package: SQLite related
PHP Version: 4.3.4 OS: linux, windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: col at mportal dot hu
New email:
PHP Version: OS:


 [2004-03-10 07:51 UTC] col at mportal dot hu
In sqlite then return of the column names changed in new versions (aktual: 2.8.13)
The return type (short name or long name) can be set with: PRAGMA short_column_names=ON; It works fine from sqlite console, but not from php. And php has no any ini setting, to change this variable. Setting this from query before select query, has no affect.

Reproduce code:
$db = sqlite_open('mydb.db',0666, $sqliteerror);
sqlite_query($db,"create table t1(id1 int,n1 varchar(5)");
sqlite_query($db,"create table t2(id2 int,n2 varchar(5)");
sqlite_query($db,"insert into t1(id1,n1) values (1,'N1')");
sqlite_query($db,"insert into t2(id2,n2) values (1,'N2')");
sqlite_query($db, 'PRAGMA short_column_names=ON');
select *, or select t1.id1, t2.id2, t1.n1, t2.n2, or select t1.*, t2.* is the same effect
$result=sqlite_query($db,'select * from t1,t2 where');
echo "<pre>",var_dump(sqlite_fetch_array($result,SQLITE_ASSOC)),"<pre>";

Expected result:
array(4) {
  string(1) "1"
  string(1) "N1"
  string(1) "1"
  string(2) "N2"

Actual result:
array(4) {
  string(1) "1"
  string(1) "N1"
  string(1) "1"
  string(2) "N2"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-10 09:08 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Bundled sqlite library is version 2.8.11, if you want to 
have latest features like "PRAGMA short_column_names" use 
external sqlite library. 
 [2004-03-10 09:23 UTC] col at mportal dot hu
Thanx, but this problem exists in bundled 2.8.11 too. I just found this pragma option workin in sqlite console, but not in php. The problem not the "PRAGMA short_column_names=ON". The problem is the name of returning columns, and the short_column_names option in sqlite which changed, and can not be set from php.

Probably a php.ini setting (or else, if it's not working from the query) could help this bug, in feature.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 21 09:01:30 2024 UTC