Open GoogleCodeExporter opened 8 years ago
1042 is a bpchar (blank-padded-char)
http://www.postgresql.org/docs/8.0/static/typeconv-query.html
17506 is not a native postgresql data type that i can find. Did you create your
own
custom data types ?
Created django ticket for the inclusion of 1042 and 20 (bpchar and int8) into
data_types_reverse: http://code.djangoproject.com/ticket/10837
Also added a patch to sqldiff to check datatypes and report when an unknown
datatype
is found.
Only question remaining is should sqldiff also inform about the difference
between a
'varchar' as suggested by Django for a field and 'char'. Personally I think
this is
not necessary as the model should work perfectly fine no matter if it's a char
or
varchar.
These changes are in the new master repository at github.
Please get the latest version from there.
Original comment by v.oostv...@gmail.com
on 16 Apr 2009 at 9:46
17506 is a django.contrib.gis.db.models.fields.PointField type, which in
postgresql
shows as a type of 'geometry'.
Original comment by jehiah
on 16 Apr 2009 at 3:07
oops I forgot to add that the latest version from github works for type 1042
I get the following error for type 17506 as db_type is None, and i'd be happy to
patch, but i don't see an example of raising errors for sqldiff
File
"/home/jczebota/adc/djangoapps/django_extensions/management/commands/sqldiff.py"
,
line 491, in get_field_db_type
db_type += ' '+check_constraint
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'unicode'
I've commited a fix here
http://github.com/jehiah/django-extensions/commit/407bdf8b8e8022fe9d798dce5a44a6
16208f96eb
which then gives me this output
-- Comment: Unknown database type for field 'the_geom' (17506)
Original comment by jehiah
on 16 Apr 2009 at 3:38
Thanks for the info and patch !
I was afraid something like that exception might happen as most of the code does
expect the result of get_field_db_type to be a string. Also I'm not very happy
with
the addition of 'unknown_db_fields' to make sure sqldiff does not comment on
the same
unknown database type multiple times. (but that is for another time to resolve
:)
The comment about unknown database type's was at the moment the best i could
think of
to handle types which are not specified by Django or sqldiff. If the message is
not
clear enough I welcome suggestions.
It would be nice to handle gis types in sqldiff but I have no experience with
gis.
I've started a branch called sqldiff-gis-types at
http://github.com/trbs/django-extensions/tree/sqldiff-gis-types
But after starting to look gis I think this might be a bit harder then a few
simple
patches.
(1) All db_types() for gis fields are None and they are all called 'geometry' in
postgresql so we need a different way of tracking the difference between
different
type of geometry fields.
(2) Need to check for gis indexes manually (currently the standard output of
sqldiff
will think they are indexes that are not defined by the model, thus needing to
be
removed from the database, this is BAD!)
Sorry for the incoherent comment, if you would like to help getting sqldiff to
support gis (or in any case handle it gracefully even if it's not support) it
would
be much appreciated.
Original comment by v.oostv...@gmail.com
on 16 Apr 2009 at 4:55
Original comment by v.oostv...@gmail.com
on 16 Apr 2009 at 5:14
Original issue reported on code.google.com by
jehiah
on 15 Apr 2009 at 1:26