-
Notifications
You must be signed in to change notification settings - Fork 227
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
Cannot insert into or update timestamp(tz) column due to mismatching type #344
Comments
Sorry for the mess of editing above. Downgrading to 2.0.1 fixed the problem for me. |
I believe this is also related to my problem: it looks like when using the EF identity implementation with npgsql, there's also confusion on the DateTime parsing. Getting messages like:
For |
Any motion on this? This is blocking me at this point. |
Looks like it's related to #358 |
@jholovacs can you please post some code so I can see your issue? It's probably not related to #358, which is about TimeSpan (which maps to PostgreSQL |
There's really no code to post, only an error when trying to use EF against
Postgres for Identity services. I try to create a new user, and I get this
message:
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while
updating the entries. See the inner exception for details. --->
Npgsql.PostgresException: 42804: column "lockout_end" is of type timestamp
with time zone but expression is of type text
As I am using migrations, it seems all is not well in the model translation.
|
Perhaps related to #303? After looking at the debug log, I was able to get the following info out:
|
@jholovacs I need a minimal code sample in order to investigate, even if it's just a minimal identity services sample. Just a bit of code that triggers the problem. |
OK, I think I figured out what the problem is: What I did to get around this is I changed the model builder for the property like so:
I don't think this is an ideal solution, but apparently when a nullable DateTimeOffset is inserted into the database, it's sent as a null string, which causes all sorts of conversion issues. By making the column a VARCHAR, and performing an explicit conversion back and forth, the system is able to handle it. |
@jholovacs, i'm still waiting for a minimal code sample... If the issue is with nullable Datetime offset, can you please write that up and post? It should be working. |
@roji As mentioned previously, I don't have a code sample. This is boilerplate stuff, built into EF Identity framework. There's no code I wrote to demonstrate this, beyond the standard I will add that this was working fine until recently, and then it stopped working. |
Is this still not working with 2.1.0 RTM? If not, any chance I can get you to submit a code sample without ASP.NET, Identity or anything else (just a small console app)? My time is very limited and any help would be appreciated. |
A lot of changes happened with 2.1.0 recently, so I have to write a bunch
of new code. I had originally written code to change PascalCase naming in
c# to snake_case naming in postgres, but all the classes for doing so
appear to have changed completely (completely broke my implementation) so I
have a lot of rework to do before I can try 2.1.0.
…On Sun, Jun 10, 2018 at 7:34 AM Shay Rojansky ***@***.***> wrote:
Is this still not working with 2.1.0 RTM? If not, any chance I can get you
to submit a code sample without ASP.NET, Identity or anything else (just
a small console app)? My time is very limited and any help would be
appreciated.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#344 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABr4dDSEqFMDWI35m5Ix3SlHPyWpOFfBks5t7QRLgaJpZM4SvAVH>
.
|
I'm sorry to hear it (although I'm not aware of any such breaking changes in the EF Core provider - unlike at the ADO level where there indeed are quite a few breaking changes). The provider has several tests where DateTimeOffset is written and read, and to make extra sure I've just successfully roundtripped some DateTimeOffsets in a test program. My guess is that there's something going on in the application or in the Identity code itself which is triggering your issue, but I need to be able to see the error via a test project or code sample. Another thought is that there were some date/time mapping changes in Npgsql 4.0.0 which could also have affected 2.1.0 - there's a chance this will just work now. I'm going to close this for now as I don't have anything to work on, but I'm interested in fixing this if it's a bug in Npgsql and will reopen as soon as more info is provided. |
Hi, I'm also getting the same issue: My table: CREATE TABLE public."TestingDetails" Code: string connstring = "Server=localhost;Port=5432;Database=test;User Id=postgres;Password=sync1694"; |
@sarath22 you're describing a different issue. This repo is for Entity Framework Core, while you're just using the ADO.NET provider. Please open a new issue in http://github.com/npgsql/npgsql with the exact exception message and stack trace. |
#630 - please look |
I'm on 2.1.0-preview1. I'm unable to insert into any table I have that uses
timestamp
ortimestamptz
(I tested with both). My .NET type isDateTimeOffset
. The relevant part of the log file is below. I don't know how to log any more than what's here, I can't seem to get the actual parameters that are being passed no matter what I try. I can provide any other info that's needed, I'm not sure what you'll need. The problem occurs on both nullable and non-nullable columns.The text was updated successfully, but these errors were encountered: