Skip to content

Non zero integer ID column #382

@sunho

Description

@sunho

Description

If I Create a model with a valid uuid id, Pop creates the model with the id given. However, if I Create a model with a non-zero (or valid) integer id, Pop ignores the id completely. This restricts me from implementing the common polymorphism pattern (Where I use same integer for id field in two or more tables)

Steps to Reproduce the Problem

  1. Model with a integer ID field
  2. model := Model{}
  3. model.ID = nonzero
  4. db.Create(&model)

Expected Behavior

Pop creates the model with the given id

Actual Behavior

Pop ignores the given id

Here's the SQL statement in the log:

INSERT INTO posts (created_at, updated_at, user_id) VALUES (:created_at, :updated_at, :user_id) returning id

Info

Latest (v4.11.0) pop
Postgresql

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalA suggestion for a change, feature, enhancement, etc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions