does postgresql 10 have something similar to sql server's set identity_insert

Поиск
Список
Период
Сортировка
От john snow
Тема does postgresql 10 have something similar to sql server's set identity_insert
Дата
Msg-id CAE67tvV54+CQ2HS=G8FbYhjrfaz-0g0Jvv_vu741RbJSCvceVw@mail.gmail.com
обсуждение исходный текст
Ответы Re: does postgresql 10 have something similar to sql server's setidentity_insert
Re: does postgresql 10 have something similar to sql server's setidentity_insert
Список pgsql-novice
to temporarily allow explicit values to be inserted into the identity column of a table to facilitate the generation of test data from application code?

using sql, i know it's possible to issue INSERTs with OVERRIDING SYSTEM VALUE clause to fill identity columns with user-specified values. but i'm using an ORM (object-relation mapper) Framework from Microsoft (Entity Framework Core 2.1)  and a C# test data generator library, and i'm generating "data aggregates" that have foreign key relationships so it would be a great convenience if I could save test data with known primary and foreign key values to the database as this would make it easier for me to make assertions about my data.

ideally, i'm looking for something like this:

myDbContext.Database.ExecuteSqlCommand("...");  //ask postgresql to allow explicit id values for inserts from here on
var testData = CreateTestData();
myDbContext.MyEntity.AddRange(testData);
myDbContext.SaveChanges();

 
thanks in advance for any tips or help!

В списке pgsql-novice по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: UNION but with excused columns
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: does postgresql 10 have something similar to sql server's setidentity_insert