I've recently updated my CVS, and I'm now getting parsing errors from the backend when I use a PREPARE statement with
varcharin the types clause.
This seems to be because of the following changes made to pgtypes.c in version 1.63.
I looked at the postgresql parser, and sure enough, the varchar(), char() etc are not accepted.
Does anyone know what the intention of this change was? (the comment says "Map (var)char type to SQL type more
properly")
Is this in fact a bug or am I missing something?
@@ -489,11 +502,11 @@ pgtype_to_name(StatementClass *stmt, Int
case PG_TYPE_INT8:
return "int8";
case PG_TYPE_NUMERIC:
- return "numeric";
+ return "numeric()";
case PG_TYPE_VARCHAR:
- return "varchar";
+ return "varchar()";
case PG_TYPE_BPCHAR:
- return "char";
+ return "char()";
case PG_TYPE_TEXT:
return "text";
case PG_TYPE_NAME:
@@ -515,10 +528,12 @@ pgtype_to_name(StatementClass *stmt, Int
case PG_TYPE_ABSTIME:
return "abstime";
case PG_TYPE_DATETIME:
- if (PG_VERSION_GE(conn, 7.0))
- return "timestamp with time zone";
- else
+ if (PG_VERSION_GT(conn, 7.1))
+ return "timestamptz";
+ else if (PG_VERSION_LT(conn, 7.0))
return "datetime";
+ else
+ return "timestamp";
case PG_TYPE_TIMESTAMP_NO_TMZONE:
return "timestamp without time zone";
case PG_TYPE_TIMESTAMP: