honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
henrik 2017-07-19T12:20:14.984328Z

That is excellent, thank you so much

2017-07-19T17:21:02.863515Z

=)

2017-07-19T17:27:02.077075Z

So I’m inclined to get a 0.10.0 release out today

seancorfield 2017-07-19T17:27:28.093039Z

With #149 reverted?

2017-07-19T17:27:31.094376Z

there’s some discussion about function application on the mailing list and I’d like to work on that but maybe in the release after that

2017-07-19T17:27:32.094913Z

yeah

seancorfield 2017-07-19T17:29:12.154634Z

:thumbsup::skin-tone-2:

seancorfield 2017-07-19T17:30:27.201135Z

I agree that the status quo (prior to #149) is confusing but I'm not sure whether we can agree on a fix that doesn't break existing code -- and #149 clearly breaks existing code so, whilst it solves some problems, it introduces others.

2017-07-19T17:32:39.280025Z

yep

2017-07-19T17:33:19.304639Z

the only thing I can think of that might be an improvement is treating lists as function calls

2017-07-19T17:33:35.313836Z

but then people wind up quoting things and that gets messy fast

seancorfield 2017-07-19T17:36:33.418911Z

I was a bit surprised at the use of tuples, to be honest. Is that standard SQL or a vendor extension?

2017-07-19T17:40:50.569258Z

oh hmm that’s a good question

2017-07-19T17:41:49.604191Z

I basically assumed it was a thing because Igor was doing it

seancorfield 2017-07-19T17:43:18.656928Z

I'd never seen it before -- but my SQL skills are not that extensive.

seancorfield 2017-07-19T17:45:39.739397Z

Bing seems to indicate it's Postgres/Oracle specific...

seancorfield 2017-07-19T17:46:05.755248Z

SQL Server, SQLite, and MySQL don't seem to support it, from what I can find.

seancorfield 2017-07-19T17:46:48.780252Z

Although ANSI SQL supposedly supports tuples as row constructors?

2017-07-19T17:48:27.838831Z

huh, interesting

seancorfield 2017-07-19T17:49:37.880857Z

Further reading suggests maybe MySQL does support tuple comparisons... I might have to try that...

2017-07-19T17:49:56.893041Z

so if it’s not standard SQL — honestly it might make sense for vectors to be reserved for function application then

seancorfield 2017-07-19T17:54:16.051457Z

MySQL supports it. TIL.

seancorfield 2017-07-19T18:13:01.740348Z

I guess it depends on how comfortable we would be breaking tuple comparison (in all cases) in order to support consistent function application? And then require, say, lists for tuples since they are much more rare than function application?

2017-07-19T18:13:31.757472Z

yeah

seancorfield 2017-07-19T18:13:55.771378Z

(that path would essentially reinstate #149 as a deliberate breaking change -- and document it that way)

2017-07-19T18:15:09.814664Z

tuple comparison can also be compiled to “where foo=bar and baz=qux” and we could provide helpers to more easily generate that if that’s helpful

2017-07-19T18:15:38.831399Z

(all-equal [:foo :bar :baz] [1 2 3]) or something

2017-07-19T18:16:54.876847Z

…if we were going to go that route I would not want to release 0.10 with #149 reverted, that would just be confusing

2017-07-19T18:17:13.887577Z

I’d feel a little bad since I said in the issue I was going to do that

seancorfield 2017-07-19T18:17:52.910694Z

select * from thing where (col1, col2) < (val1, val2) is valid but I'm not sure mapping that to ...where col1 op val1 and col2 op val2 is going to be correct in the general case?

2017-07-19T18:18:37.936989Z

huh, (col1, col2) < (val1, val2) compares in some priority order?

2017-07-19T18:18:58.949772Z

I wouldn’t have expected that to be valid but I guess it makes sense

seancorfield 2017-07-19T18:19:21.963981Z

so (50,100) < (100,50) since 50 < 100

seancorfield 2017-07-19T18:20:38.008763Z

(I just tested that in MySQL and, yup, that's the case)

2017-07-19T18:20:52.017477Z

thanks =)

2017-07-19T18:21:23.035982Z

yeah I think if I were doing it from scratch I’d reserve vectors for application and have a helper for tuples

2017-07-19T18:21:36.043201Z

where we’re at I’m not sure whether it’s worth the breaking change

seancorfield 2017-07-19T18:23:14.101679Z

There's definitely arguments on either side. There's a strong case for "tuples worked by accident because we didn't design for them, but function application not working in a value position was a bug -- and #149 fixed that, so now we're introducing a new notation for tuples..." but there's also a strong case for backward compatibility (as a general principle).

2017-07-19T18:23:29.110893Z

yeah

2017-07-19T18:23:50.123755Z

we aren’t at 1.0 yet

2017-07-19T18:24:29.147332Z

which I think means there should be less expectation of backward compatibility/“bug-for-bug” compatibility

seancorfield 2017-07-19T18:26:44.229751Z

I guess... poll the community to see how many people are using tuples?