[odb-users] Invalid postgresql type with `[` on odb 2.5.0

Boris Kolpackov boris at codesynthesis.com
Wed Nov 1 09:46:06 EDT 2023


Jarryd Beck <jarryd.beck at akunacapital.com> writes:

> We have been using odb 2.4.0 for a long time in some of our code,
> and I was looking at updating this to 2.5.0. I have tried both
> odb-2.5.0-b.19+2 and odb-2.5.0-b.25. The compiler is failing with
> this error:
> 
> src/schema/inst_schema.h:321:30: error: invalid PostgreSQL type declaration: unexpected character '['
> 
> it is coming from this piece of code:
> 
> #pragma db type("TEXT[]")
> std::vector<std::string> attr;

I get the same error until I add something along these lines:

#pragma db map type("TEXT *\\[(\\d*)\\]") \
               as("TEXT")                 \
               to("(?)::TEXT[$1]")        \
               from("(?)::TEXT")

I am pretty sure you will get the same error in 2.4.0 without such
a mapping. So it looks like it's not in effect in your build when
using 2.5.0 for some reason?

For background, see:

https://www.codesynthesis.com/products/odb/doc/manual.xhtml#14.8



More information about the odb-users mailing list