I'm using the postgresql jdbc adapter to migrate a bunch of data into a jsonb field (postgres 9.4).
After importing, date fields look correct but are displayed surrounded with doublequotes. Is there a way to tell if they are actually stored internally as date values ? If they're strings, I don't think range lookups will be very efficient.
For example, an entry in a properties
jsonb field looks like this:
"founded_on": "Sep 1, 2012 12:00:00 AM",
I can now search on, say,
SELECT CAST(properties->>'founded_on' AS DATE
and
SELECT extract('year' from cast(properties->>'founded_on' as timestamp))
and both work fine, but don't tell me whether Postgres is reparsing a string value in the jsonb field each time, as a date.
I could create an index where I cast these values to dates, and use that to search, but it seems somewhat inelegant. I'd really prefer to know that the value stored is a date. Integers and floats appear to be their actual native values, not strings, as in these:
shares_sold": 5900000,
"latitude": 33.561467,
Any feedback highly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…