#4202 closed enhancement (fixed)
limited varchar for ogr-pg driver
Reported by: | martinl | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.0 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | postgresql, varchar, width |
Cc: | pramsey |
Description
Hi,
currently OGR-PG driver doesn't allow to define fields with limited varchar type. If you define PRECISION=YES
for columns of character type OGR uses CHAR(width)
otherwise VARCHAR
. The attached patch defines VARCHAR(width)
or VARCHAR
when field width is not positive integer.
Better solution would be probably not to mix precision with char/varchar. In other words there would be new option USE_VARCHAR
which would define if to use VARCHAR
or CHAR
. Option PRECISION
would just control whether to use [VAR]CHAR(width)
or just [VAR]CHAR
. What do you think?
Attachments (1)
Change History (6)
comment:1 by , 13 years ago
Cc: | added |
---|
comment:2 by , 13 years ago
Sorry, I have attached the patch few minutes ago. So could be CHAR replaced by VARCHAR as suggested in the patch?
comment:3 by , 13 years ago
Yes, I think VARCHAR would be preferable over CHAR. I don't think there's any point in providing an option for forcing the use of CHAR.
comment:4 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
There's no attached patch.
From what can I read from http://www.postgresql.org/docs/8.3/static/datatype-character.html (the Tip paragraph), there's no advantage in using the CHAR(width) variant rather than the VARCHAR(width) one. So it's perhaps not worth proposing an option to control the use of CHAR or VARCHAR. Paul, any thought ?