View Ticket
17:37 Closed ticket [25ee8127]: PRAGMA case_sensitive_like=1 fails (artifact: dcb466d4 user: drh)
Create a branch that contains just the fix for the case_sensitive_like pragma bug, ticket [25ee81271091ec]. (check-in: ec8f23fc user: drh tags: branch-3.7.7)
17:08 Fixed ticket [25ee8127]: PRAGMA case_sensitive_like=1 fails plus 2 other changes (artifact: 15b57cdc user: drh)
Add a case to permutations.test to run the veryquick test suite using sqlite3_prepare() instead of sqlite3_prepare_v2(). This helps to test the fix for bug [25ee812710]. (check-in: d9f7993b user: dan tags: trunk)
Make sure all new statements begin life unexpired, even if they registered functions or did other actions during preparation that would have expired all statements. Fix for ticket [25ee81271091] (check-in: faa38c87 user: drh tags: trunk)
Modifications to the "like.test" script in order to expose the problem reported by ticket [25ee81271091ec27a8c5]. (check-in: c4db5b64 user: drh tags: trunk)
23:07 New ticket [25ee8127] PRAGMA case_sensitive_like=1 fails. (artifact: aab555b0 user: drh)

Ticket Hash: 25ee81271091ec27a8c5e00eeffc02949a712cb7
Title: PRAGMA case_sensitive_like=1 fails
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2011-09-19 17:37:21
Version Found In: 3.7.7
The following test program reports that the PRAGMA fails:
#include <stdio.h>
#include "sqlite3.h"

int main(void){
  sqlite3 *db3;
  char *errmsg;
  int err;

  sqlite3_open("test.db", &db3);
  err = sqlite3_exec(db3, "PRAGMA case_sensitive_like=1;", 0, 0, &errmsg);
  if (err != SQLITE_OK){
    printf("Error %d: %s\n", err, errmsg);
  return 0;

This problem was reported on the mailing list by Greg Stein. Investigation shows that the PRAGMA actually works; it simply returns an SQLITE_SCHEMA error code instead of SQLITE_OK. The problem was introduced by check-in [957b2ab67c61] by the removal of "p->expired = 0;" from the sqlite3VdbeAddOp3(). The case_sensitive_like function causes a new LIKE function to be registered, which sets "p->expired = 1", leading to the error. It is unclear (yet) why this problem was not picked up by tests.