tursodatabase / tursodatabase/libsql

support `PRAGMA foreign_keys`

Open
#1,006 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Originally filed here https://github.com/libsql/sqld/issues/287

The following SQL fails with this error using ibsql-experimental-python 0.0.25 and sqld 0.22.0.

   File "/home/runner/work/django-libsql/django-libsql/django_repo/django/db/backends/sqlite3/base.py", line 227, in disable_constraint_checking
    enabled = cursor.execute("PRAGMA foreign_keys").fetchone()[0]
ValueError: invalid column type

This code comes from Django's sqlite3 backend: https://github.com/django/django/blob/9c5e382b981608a26f2c55f1259d9e823fee5f15/django/db/backends/sqlite3/base.py#L238-L245

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with ibsql-experimental-python 0.0.25 and sqld 0.22.0 using the SQL shown in the issue. Read Django's sqlite3 backend at the linked base.py location to understand the expected PRAGMA foreign_keys result, then trace the libSQL path that handles this query. Done means the query works without the invalid column type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, django, python, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.