-
Notifications
You must be signed in to change notification settings - Fork 575
Fixes db migration with PostgreSQL 17 #3829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I think we need more @eemeli here to confirm? This seems reasonable to me. |
|
This is rather surprising, as according to the docs linked to above, |
|
@eemeli what's strange is that the |
|
@eemeli ^^ |
|
I'm unable to replicate this problem with PostgreSQL 17.7 running on MacOS using Postgres.app. To test this, I ran this dummy migration on a from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("base", "0100_android_as_mf2")]
operations = [
migrations.RunSQL(
r"""
UPDATE base_entity e
SET string = '' || e.string
WHERE e.string SIMILAR TO '%[^\S\n]%'
""",
reverse_sql=migrations.RunSQL.noop,
),
] |
|
@flozz Could you share the exact steps to reproduce the problem this PR is trying to fix? |
|
@mathjazz yep, i wanted to do it this week but i will probably not have the time. I'll try to do it next week! :) |
|
Ok... It seems we have multiple PG versions installed on our server... The IaC installs pg17 (via Ansible)... BUT the used psql client tool is v18.x and the running server is... v13.x... I think we can close this PR. It probably works with pg17, i will cleanup the server and check everyting is ok later... ¬_¬' Sorry for the time you lost on this :( |
An error occurs when running the database migration 81 on PostgreSQL 17 (I have not tested on PostgreSQL 16, and it works with PostgreSQL 15):
This PR just replaces a
\Sescape sequence by[^[:space:]]that is equivalent¹ but that works fine on PG17. :)¹ Doc: https://www.postgresql.org/docs/current/functions-matching.html#:~:text=matches%20any%20non-whitespace%20character