| From: | Célestin Matte <celestin(dot)matte(at)cmatte(dot)me> |
|---|---|
| To: | PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org> |
| Subject: | [PATCH] pgarchives: bugfix: increase listsubscription username length |
| Date: | 2025-09-22 19:13:02 |
| Message-ID: | 281f9ff6-62fd-45fa-9396-0dbf1b4abae0@cmatte.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-www |
The listsubscription username field is populated by pglister_sync,
copying information from auth_user.email, which can be up to
254 characters.
If a user defined an email address that is longer than 30
characters, pglister_sync will crash:
Traceback (most recent call last):
File "/path/pglister_sync.py", line 83, in <module>
curs.execute("WITH t(u) AS (SELECT UNNEST(%(usernames)s::text[])), ins(un) AS (INSERT INTO listsubscribers (username, list_id) SELECT u, %(listid)s FROM t WHERE NOT EXISTS (SELECT 1 FROM listsubscribers WHERE username=u AND list_id=%(listid)s) RETURNING username), del(un) AS (DELETE FROM listsubscribers WHERE list_id=%(listid)s AND NOT EXISTS (SELECT 1 FROM t WHERE u=username) RETURNING username) SELECT 'ins',un FROM ins UNION ALL SELECT 'del',un FROM del ORDER BY 1,2", {
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(30)
This patch fixes the issue by using the same max length as any
django email field for this field.
--
Célestin Matte
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Increase-listsubscriber-username-field-length.patch | text/x-patch | 2.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Célestin Matte | 2025-09-22 19:28:49 | Re: [PATCH] pgarchives: bugfix: increase listsubscription username length |
| Previous Message | Célestin Matte | 2025-09-22 18:12:35 | pglister: pgarchives does not synchronize subscribers with email delivery disabled (proposed patch) |