Skip to content

fix: break with error on postgresql 14#38040

Open
qasimgulzar wants to merge 1 commit intoopenedx:masterfrom
qasimgulzar:qasim/postgresql-improvements
Open

fix: break with error on postgresql 14#38040
qasimgulzar wants to merge 1 commit intoopenedx:masterfrom
qasimgulzar:qasim/postgresql-improvements

Conversation

@qasimgulzar
Copy link
Contributor

Description

This pull request makes a targeted update to how PostgreSQL database types are specified in the courseware/fields.py file. Specifically, it changes the type returned for PostgreSQL from BIGSERIAL to BIGINT in both the db_type and rel_db_type methods. This ensures that auto-incrementing behavior is not implicitly assumed and aligns with scenarios where a plain integer type is needed.

Database type adjustments for PostgreSQL:

  • Changed the return value for PostgreSQL from BIGSERIAL to BIGINT in the db_type method of courseware/fields.py to avoid implicit auto-increment and better match intended usage.
  • Updated the rel_db_type method to return BIGINT instead of BIGSERIAL for PostgreSQL, ensuring consistency in type handling.

Useful information to include:

  • When executing migrations with postgresql 14 getting error ERROR: both default and identity specified for column "id" of table "grades_persistentsubsectiongrade"

Supporting information

It is because django is creating unsupported DDL.

CREATE TABLE "grades_persistentsubsectiongrade" ("created" timestamp with time zone NOT NULL, "modified" timestamp with time zone NOT NULL, "id" BIGSERIAL NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "user_id" integer NOT NULL, "course_id" varchar(255) NOT NULL, "usage_key" varchar(255) NOT NULL, "subtree_edited_date" timestamp with time zone NOT NULL, "course_version" varchar(255) NOT NULL, "earned_all" double precision NOT NULL, "possible_all" double precision NOT NULL, "earned_graded" double precision NOT NULL, "possible_graded" double precision NOT NULL)

Testing instructions

After adding fix re-applied migrations for Grades app it work this time.
image

It has also added ID column for both the tables bitint (auto increment) which is desired type.
image

Deadline

None

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 22, 2026
@openedx-webhooks
Copy link

Thanks for the pull request, @qasimgulzar!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@qasimgulzar
Copy link
Contributor Author

@ormsbee could you please review this PR.

@qasimgulzar
Copy link
Contributor Author

@sarina I have also tested https://github.com/qasimgulzar/tutor-contrib-postgresql plugin to setup single command instance. Could you please attache this plugin with openedx doc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants