Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

1. Can't define variables as easily as in SQL.

2. Weak support for functions/SPs as a result.

3. Naming conventions inconsistent with SQL which makes any ORMs a pain.



What are you referring to as "SQL"? As far as I know, ISO-standard SQL doesn't have variables outside of its procedural language. I'm also not aware of any SQL-wide naming conventions. But I haven't read any of the standards, so I could be missing something.


"T-SQL" - in reality, everyone just refers to it as SQL Server even though it's obviously not a language.

I find this syntax super helpful:

DECLARE @someName AS VARCHAR(100) SET @someName= 'Bob'

When coupled with SPs and Functions, you can write some fairly readable logic in SQL. I am completely against this for most applications, but when you need it, it helps.


Oh, alright. I know T-SQL and have actually missed variables in PostgreSQL before. Just please don't shorten it to "SQL", it's only one dialect of many.


> have actually missed variables in PostgreSQL before

You can just use a DO-block with plpgsql (or any other installed procedural language) code to make variables available in Postgres. T-SQL just somewhat elides the distinction between declarative and procedural code.

https://www.postgresql.org/docs/current/sql-do.html


imho all of these are easily offset by the fact that unlike in sqlite or mysql, `cast('1,031' as int)` will throw an error instead of returning 1.


Schemas are also a lot more usable than namespaces in SQL, as a random note.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: