Hi, On 2021-03-24 16:08:13 +1300, Thomas Munro wrote: > ... Andres just asked me the same question, when we were discussing > the pq_peekmessage() patch (v7). I had remembered that POLLHUP didn't > work for this type of thing, from some earlier attempt at something > similar, and indeed on my first attempt to do that here as an > alternative design, it did not work... with TCP sockets (localhost)... > though it did work with Unix sockets. Gah! Then he pointed me at > POLLRDHUP (a Linux only extension) and that did seem to work in all > cases I tried. But without that, this v8 patch doesn't seem to work > on FreeBSD (TCP), and for the rest of the menagerie, who knows? > Here's a sketch patch like that for discussion. > It's frustrating, because this patch is so simple, and doesn't have > v7's problem with pipelined queries. Hmm.
It is indeed frustrating. I searched a bit for other OSs and POLLRDHUP and I'm annoyed by responses from various OS folks of "You don't need that, just read the data upon POLLIN...". I don't like the feature not handling pipelining etc, nor does working undetectedly only on linux seem like a great answer. I guess we could have the template files tell us wether it work, or configure test it, but brrr. I'm mostly joking, and I've not read the thread, but I assume just sending an empty NoticeResponse or error message has been brought up and laughed out of the room? > (I tried to make it work on Windows too by reading the manual, no idea > if that part compiles or works). If the patch had tests, cfbot might tell you :) Greetings, Andres Freund