#36101: Support BIT data type model field for MySQL and PostgreSQL
-------------------------------------+-------------------------------------
Reporter: Jordan Bae | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jordan Bae):
* summary: Support bit data type model field on MySQL, PostgreSQL =>
Support BIT data type model field for MySQL and PostgreSQL
Old description:
> Currently Django model field doesn't support bit data type.
>
> I think It can be helpful to handle bit data type on MySQL, PostgreSQL.
>
> Especially I have below experience.
>
> When I was trying to make a read-only model with inspectdb, bit data type
> column was made by TextField with `This field type is a guess.`.
>
> It's not a bug. but BitField will makes efficiency bit data type and
> other experiences on Django
New description:
Support BIT data type model field for MySQL and PostgreSQL
Currently, Django's model fields do not support the BIT data type which is
available in both MySQL and PostgreSQL databases.
Key reasons for adding BIT data type support:
1. Improved Database Inspection
- When using `inspectdb` on tables containing BIT columns, Django
currently falls back to TextField with a "This field type is a guess"
comment
- Native BitField support would provide accurate model generation for
existing databases
2. Database-specific Features
- MySQL: Support for BIT(M) where M can specify the number of bits
- PostgreSQL: Support for both BIT(n) and BIT VARYING(n) types
3. Use Cases
- Efficient storage of boolean flags and bit flags
- Direct mapping to database-native bit operations
- Better integration with legacy databases using BIT columns
This enhancement would improve Django's database type coverage and provide
more efficient handling of bit-based data.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/36101#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701946a7cb0a4-efe1a7f9-f319-4b0c-8820-4efb11ea4fe2-000000%40eu-central-1.amazonses.com.