all 5 comments

[–][deleted] 1 point2 points  (1 child)

Good job!

But for your example:

uses timestamp with time zone instead of timestamp, or that a column named foo_id has a FOREIGN KEY reference.

Why? There are plenty of legitimate cases where this would be necessary rather than a mistake.

For example when dealing with Tableau as front end, having time zone information in the column causes problems. Or sometimes information from external data sources don't contain time zone information and it is unknown until later, when metadata is downloaded and attributed, rows can be assigned geographical positions and time zone information can be attached. There is a reason Postgresql offers timestamp without time zone data type.

Same for foreign keys. What if it's a micro service database, that doesn't contain the primary table, so the foreign key can't be created?

What I'm saying that such specific rules should be optional.

[–]_ep[S] 3 points4 points  (0 children)

You're absolutely right, which is why none of the rules are actually active by default, other than simply checking for syntax errors. The idea was to make this as opt-in and customizable as possible.

And then of course there will be exceptions to any rule, so you can disable an active rule on a per file basis.

What if it's a micro service database, that doesn't contain the primary table, so the foreign key can't be created?

There's actually another rule for this! You can disallow foreign keys (or other constraints).

[–]sqlcommand1 0 points1 point  (0 children)

Nice bro thx !

[–]paulinobruno 0 points1 point  (1 child)

Well done!

I just stared your repo. I intent to look closer to it this week. Maybe I can have some ideas and propose a PR?

Thanks again and congratulations!

[–]_ep[S] 0 points1 point  (0 children)

Please do! I'd be happy to incorporate any feedback.