Hacker News new | ask | show | jobs
by mrkeen 35 days ago
Hi apologist. How was the woodwork? Your exact comment was why I wrote mine.

  You could write predicates over non-existent columns:

  root=> SELECT * FROM t
         WHERE definitely_not_a_column = 4;
Cool, definitely_not_a_column doesn't exist, so therefore that whole WHERE clause doesn't exist either, so the real query is SELECT FROM t.

  SELECT * FROM t WHERE 4 = 5;
   a | b
  ---+----
   5 | 6
  (1 row)
We're comparing 4 and 5. Precedent?

  System.out.println(((Integer)4).compareTo((Integer)5));
  > -1
What happens when you treat -1 as a bool? The following languages agree that -1 is true: C, C++, JS, Python, PHP, Ruby, Perl, Lua, R.

So it's SELECT FROM t WHERE true;

Now, let's get busy blaming Jepsen for using the tool wrong.

3 comments

> therefore that whole WHERE clause doesn't exist either

No, therefore the condition is unsatisfiable and equivalent to WHERE FALSE. And that's letting you ignore the SQL spec, which says the query is invalid and should return "Column not found" because the column name cannot be resolved.

> We're comparing 4 and 5. Precedent?

I really hope you're trolling, for your own sake.

The explanation is more damning than the devex.

The condition is unsatisfiable, and the engine went ahead and gave a 0-warning result?

Are you claiming that 4 = 5?
I'm claiming that

1) It would be no more fucked up than anything else that has been grandfathered into our tools.

2) If it already had mass adoption in the market, people would jump onto this thread to explain to me that I just don't understand the brilliant semantics behind language of why 4 = 5.

I spent more time than I’d like to admit trying to understand your comments here. I’m convinced you are a very odd person with a confused mind.

Brilliant semantics? No one said anything normative. You’re arguing with yourself on your own non-sequitur. SQL is SQL. It’s extremely flawed but who freaking cares, that’s why ParticleDB shouldn’t have tried to implement SQL let alone full postgres compatibility when they clearly are not equipped to do so! Your comments about how strange and non-intuitive SQL are true but irrelevant.

Apologist for what?