From fcc35a5edba58cd72b2e66b68478744dc56f05d6 Mon Sep 17 00:00:00 2001 From: tbussmann Date: Thu, 27 Oct 2016 22:08:57 +0200 Subject: [PATCH] use a different approach for http_head example in readme.md --- README.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b644eb8..2586ba2 100644 --- a/README.md +++ b/README.md @@ -112,21 +112,17 @@ To access binary content, you must coerce the content from the default `varchar` --------------+---------------+---------------- image/gif | 31958 | 31958 -To access only the header you can do a HEAD-Request. This will not follow redirections. +To access only the headers you can do a HEAD-Request. This will not follow redirections. - WITH - http AS ( - SELECT * FROM http_head('http://google.com') - ), - headers AS ( - SELECT (unnest(headers)).* FROM http - ) SELECT - http.status, - headers.value AS location - FROM http - LEFT OUTER JOIN headers - ON (headers.field = 'Location'); + http.status, + headers.value AS location + FROM + http_head('http://google.com') AS http + LEFT OUTER JOIN LATERAL (SELECT value + FROM unnest(http.headers) + WHERE field = 'Location') AS headers + ON true; status | location --------+-----------------------------------------------------------