Skip to content
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

Non zero integer ID column #382

Open
sunho opened this issue May 22, 2019 · 0 comments
Open

Non zero integer ID column #382

sunho opened this issue May 22, 2019 · 0 comments
Labels
proposal A suggestion for a change, feature, enhancement, etc

Comments

@sunho
Copy link

sunho commented May 22, 2019

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

@stanislas-m stanislas-m added the proposal A suggestion for a change, feature, enhancement, etc label Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A suggestion for a change, feature, enhancement, etc
Projects
None yet
Development

No branches or pull requests

3 participants