question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PostgreSQL IsIdentity is creating the PK the old way?

See original GitHub issue

Describe the question When I’m creating a new table for my PostgreSQL v12.2 and I set the IsIdentity property to true for the PK the column is created as serial NOT NULL. This is the old way of creating PK in PostgreSQL (before v10) and the new way is int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY

Do you know how can I set this option so the PK can be created by the new way?

Information (please complete the following information):

  • OS: Windows 10
  • Platform: .NET Core 3.1
  • FluentMigrator version: 3.2.6
  • FluentMigrator runner: “in-process runner”
  • Database Management System: Postgres v12.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Jun 1, 2020

@KrisPetkov Is this causing an error, or is this a stylistic change you prefer?

0reactions
jzabroskicommented, Jun 2, 2020

Thank you as well for the great discussion! You help make projects like these worth the effort!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostgreSQL 10 identity columns explained
CREATE TABLE test_old ( id serial PRIMARY KEY, payload text ); INSERT INTO ... A general problem with the old way is that...
Read more >
Why does Postgres generate an already used PK value?
DETAIL: Key (id)=(1) already exists. My Postgres database does in fact have a myapp_mymodel object with the primary key of 1. Why would...
Read more >
PostgreSQL Identity Column
This tutorial shows you how to use the GENERATED AS IDENTITY constraint to create the PostgreSQL identity column for a table.
Read more >
Better to use SERIAL PRIMARY KEY or GENERATED ...
The GENERATED AS IDENTITY constraint is the SQL standard-conforming variant of the good old SERIAL column. In the example they use the identity...
Read more >
Auto-generated primary keys: UUID, serial or identity column?
This article explores the old question what to use for autogenerated primary keys: UUID, serial or identity column?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found