You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The enum value NpgsqlDbType.TimestampTZ is marked deprecated and instead users should use TimetampTz. That's fully understandable, however we map types with enum values as strings (so we don't have to take a direct reference on the ADO.NET provider, but can set the enum value in the DbParameter at runtime through IL generated setters). We used to map Timestamptz as 'Timestamp' but should use TimestampTZ/z. To fix that issue in our code we therefore have to pick a TimestampTZ/z variant: the one currently deprecated (but present in the npgsql dll on nuget) or the one with 'z', which is the name going forward. I can only pick one.
So the question is: will TimestampTZ ever be removed? If it's marked as 'deprecated' that's ok, the code isn't linked in the compiler anyway (only through DbProviderFactory and reflection). However if it's removed (because it's deprecated), then we have a problem.
I know it's hard to look into the future ;) but if you have a policy of never remove stuff anyway and only mark things deprecated going forward, we won't run into the issue where an enum value 'TimestampTZ' isn't present and it breaks at runtime.
I didn't have any concrete plan to remove TimestampTZ (TimeTZ is the same), but there also isn't any sort of hard policy to never remove/break things... I admit that I would like to remove it them at some point, to keep the library clean going forward.
In theory you could have two string options to try in your reflection, right? I'm sure it's not something you'd love to do, but is it a huge pain?
BTW, do you have some continuous integration testing LLBGen against Npgsql's dev branch or something? If so, is this the only issue you've noticed? It's nice to have external automatic validation of Npgsql's backwards compat...
hey @roji great to see you too! :) It's ok if it's in a few years from now and not the next version in say a few months, then it's fine by me. I understand you want to clean up stuff at some point, e.g. with v4. We could test for that version for example and switch types then.
The problem is that we generate the type name in the code, so there's just room for one version. Our code simply reflects on the values in the enum and builds lookups for name-> enum value and a setter from IL to set the property on the NpgsqlParameter. So unfortunately we have just room for one value.
If you don't remove it in the v3 lifetime it's ok and it would work out fine for us. If you remove it in v4 for instance, we can solve it then, that's not a problem.
No CI here, sorry :) We only use integration tests but for specific things which differ per db as most code is generic. A customer ran into this (a local datetime wasn't converted to UTC, due to this). A typeconverter solved it but it's better if we solve the mapped type, and there we ran into this :)
For now I'm not really following strict semver for Npgsql - I do introduce breakage, sometimes even somewhat substantial, in minor versions (e.g. 3.3). It's not very different from how PostgreSQL themselves versioned (major and minor were more or less the same) before the 10.0 release. So basically there won't be a version 4 until Npgsql receives a substantial rewrite or something, which I don't really plan in the near future. Basically don't worry about it, and I'll add a comment pointing to this issue in the code to avoid killing it by mistake.
@FransBouma just doing some cleanup around obsoletions and noticed this - do you think it's OK for us to remove NpgsqlDbType.TimestampTZ and TimeTZ at this point (6 years later 😅)? One reason we want to do this is that it seems to break PowerShell (with the only difference in members being the casing...)
@FransBouma just doing some cleanup around obsoletions and noticed this - do you think it's OK for us to remove NpgsqlDbType.TimestampTZ and TimeTZ at this point (6 years later 😅)? One reason we want to do this is that it seems to break PowerShell (with the only difference in members being the casing...)
It's fine with me, we switched to TimestampTz a while ago, so our code only uses TimestampTz and not TimestampTZ :) Vacuum away! :D
Activity
roji commentedon Oct 27, 2017
Hey @FransBouma, nice to see you :)
I didn't have any concrete plan to remove
TimestampTZ(TimeTZis the same), but there also isn't any sort of hard policy to never remove/break things... I admit that I would like to remove it them at some point, to keep the library clean going forward.In theory you could have two string options to try in your reflection, right? I'm sure it's not something you'd love to do, but is it a huge pain?
roji commentedon Oct 27, 2017
BTW, do you have some continuous integration testing LLBGen against Npgsql's dev branch or something? If so, is this the only issue you've noticed? It's nice to have external automatic validation of Npgsql's backwards compat...
FransBouma commentedon Oct 27, 2017
hey @roji great to see you too! :) It's ok if it's in a few years from now and not the next version in say a few months, then it's fine by me. I understand you want to clean up stuff at some point, e.g. with v4. We could test for that version for example and switch types then.
The problem is that we generate the type name in the code, so there's just room for one version. Our code simply reflects on the values in the enum and builds lookups for name-> enum value and a setter from IL to set the property on the NpgsqlParameter. So unfortunately we have just room for one value.
If you don't remove it in the v3 lifetime it's ok and it would work out fine for us. If you remove it in v4 for instance, we can solve it then, that's not a problem.
No CI here, sorry :) We only use integration tests but for specific things which differ per db as most code is generic. A customer ran into this (a local datetime wasn't converted to UTC, due to this). A typeconverter solved it but it's better if we solve the mapped type, and there we ran into this :)
roji commentedon Oct 27, 2017
OK, no problem.
For now I'm not really following strict semver for Npgsql - I do introduce breakage, sometimes even somewhat substantial, in minor versions (e.g. 3.3). It's not very different from how PostgreSQL themselves versioned (major and minor were more or less the same) before the 10.0 release. So basically there won't be a version 4 until Npgsql receives a substantial rewrite or something, which I don't really plan in the near future. Basically don't worry about it, and I'll add a comment pointing to this issue in the code to avoid killing it by mistake.
Added comment to retain obsolete enum names
FransBouma commentedon Oct 28, 2017
@roji thanks man, I'll proceed and add the TimezoneTZ mapping and also add a note that it will change in the future :) Keep up the good work!
roji commentedon Nov 13, 2023
@FransBouma just doing some cleanup around obsoletions and noticed this - do you think it's OK for us to remove NpgsqlDbType.TimestampTZ and TimeTZ at this point (6 years later 😅)? One reason we want to do this is that it seems to break PowerShell (with the only difference in members being the casing...)
FransBouma commentedon Nov 13, 2023
It's fine with me, we switched to
TimestampTza while ago, so our code only usesTimestampTzand notTimestampTZ:) Vacuum away! :Droji commentedon Nov 13, 2023
Thanks @FransBouma!