php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #79433 Update sqlite3 to support generated columns (3.31)
Submitted: 2020-03-30 10:48 UTC Modified: 2020-03-30 11:19 UTC
From: l33tengineer at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PDO SQLite
PHP Version: 7.4.4 OS: debian 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:
MUST BE VALID
Solve the problem:
21 + 32 = ?
Subscribe to this entry?

 
 [2020-03-30 10:48 UTC] l33tengineer at gmail dot com
Description:
------------
Generated column support was added with SQLite version 3.31.0 (2020-01-22).
Php does not yet support this version and with it the generated column syntax.

I'd like to propose an update to the sqlite extension to allow for the generated column syntax as described in https://sqlite.org/gencol.html.
Creating an (in-memory) sqlite database with `GENERATED ALWAYS AS` sql now gives a syntax error.

Test script:
---------------
<?php
$db = new \PDO('sqlite::memory:');
$sql = <<<SQL
CREATE TABLE t1(
   a INTEGER PRIMARY KEY,
   b INT,
   c TEXT,
   d INT GENERATED ALWAYS AS (a*abs(b)) VIRTUAL,
   e TEXT GENERATED ALWAYS AS (substr(c,b,b+1)) STORED
);
SQL;
$result = $db->exec($sql);
var_dump($result);
var_dump($db->errorInfo());


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-30 11:19 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-03-30 11:19 UTC] cmb@php.net
As of PHP 7.4.0, libsqlite3 is no longer bundled, so this request
makes no sense.  You just have to compile PHP with a recent
libsqlite3.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC