P3 icon indicating copy to clipboard operation
P3 copied to clipboard

Custom column type

Open dclausen opened this issue 2 years ago • 3 comments

I have the following custom column type: CREATE TYPE public.money_with_currency AS (currency_code char(3), amount numeric(20,8))

When running: select * from table with that column, I'm getting: P3Error Cannot convert type with OID 23409

Do you have any suggestions on how I could pass that type to P3?

dclausen avatar Feb 21 '23 15:02 dclausen

I was able to map these columns to strings in typeMap but I'm wondering if the default should be to do this automatically?

dclausen avatar Feb 21 '23 20:02 dclausen

Hi,

First, thanks for the feedback, this is always important.

If you define your own types, they are not mapped, so something must happen.

Maybe you can find some inspiration in #loadEnums ?

It has been a while since I worked on P3, I will think a bit more about it.

It would certainly be interesting to see (in code) what you actually did. Maybe it can become a unit test / executable example ?

Sven

svenvc avatar Feb 21 '23 20:02 svenvc

I created a new unit test / executable example: https://github.com/svenvc/P3/commit/a1982389e992e4bb5f8033b0fee1d6bc12929bcc

svenvc avatar Feb 24 '23 12:02 svenvc