TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Dbcritic: Constructively criticizing your Postgres schema (using Idris)

77 点作者 rkrzr将近 4 年前

5 条评论

ruuda将近 4 年前
Great to see this being open sourced! Every project that relies on a Postgres database should put this in their CI pipeline, it's that good.
yzan将近 4 年前
There is also DBLint (<a href="https:&#x2F;&#x2F;archive.codeplex.com&#x2F;?p=dblint" rel="nofollow">https:&#x2F;&#x2F;archive.codeplex.com&#x2F;?p=dblint</a>), which has a fairly comprehensive set of checks.
评论 #27769015 未加载
评论 #27769029 未加载
m_j_g将近 4 年前
It is nice to see practical application of dependently typed language!
评论 #27765835 未加载
neolog将近 4 年前
Why is this written in Idris instead of a normal language?
评论 #27766104 未加载
yosamino将近 4 年前
&gt; Because the vast majority of our use cases for storing timestamps is to represent specific, unambiguous moments in time, we pretty much always want to use the timestamptz type.<p>This advice is not great. One needs to specifically know their data.<p>Postgresql stores the timezone numerically, and not together with the location the timezone applies to. This means it is impossible to deduce DST from a timestamptz alone, but this is neccessary because two different locations in the same timezone might very possibly switch to and from DST at different times of the year.<p>To store an unambiguous moment in time ( e.g. when scheduling an international conference call) one can store it as a timestamptz but this doesn&#x27;t gain a lot over just treating all time in the database as UTC and then converting from&#x2F;to local time for input&#x2F;display.<p>To store a time that is unambiguous in a certain location (e.g. a doctor&#x27;s appointment in 4 months time) one needs to store it as timezone without timezone and an extra field with the locality. It makes no sense to store the timezone, unless you <i>also store the DST</i> information or unless you think you can rule out unexpected DST changes.<p>Storing timestamptz really makes a lot of sense for past events though - for example when logging.<p>So it really depends on what kind of timestamp you are trying to store, and I am not sure there is a general rule that can be applied.
评论 #27764840 未加载
评论 #27764502 未加载
评论 #27763746 未加载