get json doc storage to work

This commit is contained in:
Paul Trowbridge 2018-05-25 14:03:01 -04:00
parent 0196ba4c53
commit 053ddb0c9e
3 changed files with 70 additions and 31 deletions

View File

@ -1,29 +1,31 @@
{
"id": 1,
"doc": {
"rows": [
{
"elements": [
{
"status": "OK",
"distance": {
"text": "225 mi",
"value": 361940
},
"duration": {
"text": "3 hours 50 mins",
"value": 13812
[
{
"id": 1,
"doc": {
"rows": [
{
"elements": [
{
"status": "OK",
"distance": {
"text": "225 mi",
"value": 361940
},
"duration": {
"text": "3 hours 50 mins",
"value": 13812
}
}
}
]
}
],
"status": "OK",
"origin_addresses": [
"Washington, DC, USA"
],
"destination_addresses": [
"New York, NY, USA"
]
]
}
],
"status": "OK",
"origin_addresses": [
"Washington, DC, USA"
],
"destination_addresses": [
"New York, NY, USA"
]
}
}
}
]

View File

@ -0,0 +1,37 @@
SELECT
*
FROM
tps.srce_import(
'DMAPI'
,$$
[{
"id": 1,
"doc": {
"rows": [
{
"elements": [
{
"status": "OK",
"distance": {
"text": "225 mi",
"value": 361940
},
"duration": {
"text": "3 hours 50 mins",
"value": 13812
}
}
]
}
],
"status": "OK",
"origin_addresses": [
"Washington, DC, USA"
],
"destination_addresses": [
"New York, NY, USA"
]
}
}]
$$::JSONB
)

View File

@ -28,11 +28,11 @@ FROM
"type": "numeric",
"column_name": "duration"
}
],
"constraint": [
"{doc}"
]
}
},
"constraint": [
"{doc}"
]
}
$$
) r(x);