Open SXNhcXVl opened 4 months ago
There is also a problem with accentuation/encoding
I must say I'm a bit surprised that it took all this time to discover this problem. I'm afraid it's because most people don't use camelCase in naming columns. If you look at the source file pyrseas/database.py
and in particular at the Database.to_map()
and Database.diff_map()
functions you'll notice they both take a quote_reserved
argument, which defaults to True. That causes both dbtoyaml
and yamltodb
to use double quotes around reserved words such as case
and false
(case-insensitive). But you're right, since PostgreSQL supports case-sensitive (camelCase or otherwise) names for tables, columns and other objects, Pyrseas ought to support that too.
It's easy to say "ought to support", but the fact is that I haven't touched Pyrseas code for about ten months (and neither has anyone else except the person working on #256). If you really want this supported, I would encourage you to create a couple of simple tests, e.g., in the source tests/dbobject/test_table.py
. We would need to check both dbtoyaml
and yamltodb
. For example, a test to CREATE TABLE "TaBeLa" ("cOluNa" integer)
should suffice to start. I hope that the dbtoyaml
part will work "as is", i.e., the YAML file should not need double quotes to support the mixed case. The yamltodb
should fail to produce the expected double-quoted mixed case names, but that should help us track down what needs to change.
As far as accents and encoding, I'm not so sure. I believe we have tested names with Unicode characters like ç
, German and even Cyrillic characters (see test_extern_file.py
). In your example, the only discrepancy I see is the 'No' which I'm not sure if it's followed by a superscript letter 'o' (which perhaps is encoded as U+1D52?) or a 'º' (ordinal indicator U+00BA).
the yamltodb tool is not placing the names of schemas, tables and columns in double quotes, this causes problems in schemas that use camelCase tables and columns
out of yamltodb
the correct thing would be
error