Re: Binary Cursors, and the COPY command - Mailing list pgsql-hackers
From | pgsql@mohawksoft.com |
---|---|
Subject | Re: Binary Cursors, and the COPY command |
Date | |
Msg-id | 17868.24.91.171.78.1090893988.squirrel@mail.mohawksoft.com Whole thread Raw |
In response to | Re: Binary Cursors, and the COPY command (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: Binary Cursors, and the COPY command
|
List | pgsql-hackers |
> pgsql@mohawksoft.com writes: >> Lastly, the vast majority of machines in use today are intel. Meaning >> that >> they are small endian. Except in a very rare circumstance, two machines >> that would normally be able to communicate in native byte order, will >> ALWAYS have to convert data. > > Quite honestly, that is exactly one of the reasons for using network > order. If we standardized on little-endian then 90% of programmers > would ignore the need to do anything about byte ordering issues, and > their code would be unportable to big-endian machines. So what you are saying is that you should inconvenience 90% of your users to make sure they do something "right?" When you *really* think about it, by forcing a big endian byte order over machine dependent byte order, you are inconveniencing 90% of the users, but only helping the very small amount of people who run in mixed environments where the server is intel and the client is big endian. > > Putting a byte order flag into the header doesn't improve matters; > it just forces everybody to deal with *both* orders, which is not > simpler. (Except for those who would like not to be bothered with > portability, which is a position I have zero sympathy for.) While I understand your lack of sympathy, I think you are too removed from the trenches. There is a viable argument in many projects for machine dependent constructs. Sometimes there are real-world performance and delivery goals with absolutely stated objectives that the project is not heterogenus. > > If you don't want to deal with this, don't use binary data. It's as > simple as that. That's not a good answer either. Come on, what the hell good is having a "BINARY" if the data is not usable? Using ascii isn't good either because you need a text parser for every possible interpretation of the various simple types. > > BTW, for your stated use-case of combining binary output from separate > databases, I should think you'd be happy about having a not-so-machine- > dependent data format. It would still work if the databases were > running on servers of different endianness. Few deployments will *ever* really have different endian-ness amongst their servers. 99% of all deployments will be the same or compatible hardware, and probably intel at that. OK, so you like the idea of binary being "big endian," what about the idea of adding a keyword that is exclusive of "binary" called "native" or something like that? DECLARE fubar NATIVE CURSOR ... COPY fubar {FROM | TO} {'filename' | STD..} WITH [NATIVE | BINARY] ...
pgsql-hackers by date: