I wrote: > What is the point of pg_conversion.condefault (the flag that says whether > a conversion is "default")? AFAICS, there is absolutely no way to invoke > a conversion that is not default, which means we might as well eliminate > the concept.
> I do not see a lot of point in the namespacing of encoding conversions > either. Does anyone really need or use search-path-dependent lookup of > conversions? (If they do, it's probably broken anyway, since for example > we do not trouble to re-identify the client encoding conversion functions > when search_path changes.) > While actually removing pg_conversion.connamespace might not be worth > the trouble, it's mighty tempting to have just a single unique index on > (conforencoding, contoencoding), thereby enforcing that There Can Be Only > One conversion between any given pair of encodings, and then we can just > use that index to find the right entry without any fooling with search > path. > But in any case we should get rid of the concept of defaultness, because > it's pointless; all entries should be equally "default". After further poking around, I realized that there *used* to be a way to get at non-default encoding conversions, but it was removed here: commit 02138357ffc8c41a3d646035368712a5394f1f5f Author: Andrew Dunstan <and...@dunslane.net> Date: Mon Sep 24 01:29:30 2007 +0000 Remove "convert 'blah' using conversion_name" facility, because if it produces text it is an encoding hole and if not it's incompatible with the spec, whatever the spec means (which we're not sure about anyway). Now, the big problem there was that the function could produce values of type "text" that violate the current database encoding. We could have retained the facility by making the function take and return bytea, as convert() does today, but apparently nobody spoke up for the need then or since. Still, somebody might want it someday, and it would be pretty messy to remove the concept of a default encoding only to have to put it back later. I still think however that search-path-based lookup of default encoding conversions is a Bad Idea, and that we only ought to allow one default conversion to exist for any pair of encodings. I realized that we could implement that without too much trouble by redefining pg_conversion.condefault as being true for default conversions and NULL (not false) for non-default ones. With this definition, a unique index on pg_conversion (conforencoding, contoencoding, condefault) would have the behavior we want --- sort of a poor man's partial unique index, except that it would work correctly on a system catalog whereas a true partial index wouldn't. Thoughts? regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers