diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-01-31 11:48:23 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-01-31 11:48:23 -0500 |
commit | 5384a73f98d9829725186a7b65bf4f8adb3cfaf1 (patch) | |
tree | 7d0906859b26e82bb5d54a5297c072b708f82dbd /src/backend/commands/explain.c | |
parent | 4c6cedd1b014abf2046886a9a92e10e18f0d658e (diff) | |
download | postgresql-5384a73f98d9829725186a7b65bf4f8adb3cfaf1.tar.gz postgresql-5384a73f98d9829725186a7b65bf4f8adb3cfaf1.zip |
Built-in JSON data type.
Like the XML data type, we simply store JSON data as text, after checking
that it is valid. More complex operations such as canonicalization and
comparison may come later, but this is enough for not.
There are a few open issues here, such as whether we should attempt to
detect UTF-8 surrogate pairs represented as \uXXXX\uYYYY, but this gets
the basic framework in place.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index e297e9cfb90..e35ac590301 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -242,7 +242,7 @@ ExplainResultDesc(ExplainStmt *stmt) { TupleDesc tupdesc; ListCell *lc; - bool xml = false; + Oid result_type = TEXTOID; /* Check for XML format option */ foreach(lc, stmt->options) @@ -253,7 +253,12 @@ ExplainResultDesc(ExplainStmt *stmt) { char *p = defGetString(opt); - xml = (strcmp(p, "xml") == 0); + if (strcmp(p, "xml") == 0) + result_type = XMLOID; + else if (strcmp(p, "json") == 0) + result_type = JSONOID; + else + result_type = TEXTOID; /* don't "break", as ExplainQuery will use the last value */ } } @@ -261,7 +266,7 @@ ExplainResultDesc(ExplainStmt *stmt) /* Need a tuple descriptor representing a single TEXT or XML column */ tupdesc = CreateTemplateTupleDesc(1, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "QUERY PLAN", - xml ? XMLOID : TEXTOID, -1, 0); + result_type, -1, 0); return tupdesc; } |