steampipe-postgres-fdw icon indicating copy to clipboard operation
steampipe-postgres-fdw copied to clipboard

Join with net_http_request table fails to get quals to do the HTTP queries

Open e-gineer opened this issue 3 years ago • 1 comments

Thought I'd try joining the hackernews_new table with the net_http_request table to try and send slack messages for new items ... fun idea, but unfortunately it doesn't work because of the postgres plan. I couldn't find a way to trick it either.

with new_posts as (
  select
    '{"text": "' || title || '"}' as slack_msg
  from
    hackernews_new
  where
    time > now() - interval '1 min'
  order by
    time desc
)
select
  r.url,
  r.method,
  r.response_status_code,
  jsonb_pretty(r.request_headers) as request_headers,
  r.response_body
from
  net_http_request as r,
  new_posts as p
where
  r.url = 'https://hooks.slack.com/services/<redacted>/<redacted>/<redacted>'
  and r.method = 'POST'
  and r.request_body = p.slack_msg
  and r.request_headers = '{"content-type": "application/json"}'::jsonb

Here is the quals log I see:

2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes: urls=["https://hooks.slack.com/services/<redacted>/<redacted>/<redacted>"]
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes:
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   query cols=
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | request_body = ?
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | url = https://hooks.slack.com/services/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
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | method = POST
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | request_headers = {
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   |     "content-type": "application/json"
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | }
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes:
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   request headers=
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | {
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   |     "content-type": "application/json"
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | }
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   

e-gineer avatar Aug 06 '22 16:08 e-gineer

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar May 01 '25 08:05 github-actions[bot]

This issue was closed because it has been stalled for 90 days with no activity.

github-actions[bot] avatar Jun 01 '25 08:06 github-actions[bot]