NikolayS / postgresql-http-client

HTTP client inside your PostgreSQL. Easy to install. No compilation required. API-friendly
BSD 2-Clause "Simplified" License
25 stars 5 forks source link

Hello (postgres 9.4 compatibility) #2

Open jcleiva opened 6 years ago

jcleiva commented 6 years ago

Having some sql stament errors

jcleiva commented 6 years ago

This sql statement coalesce(nullif(current_setting('http_client.default_headers'), ''), '{}')::jsonb || coalesce(headers, '{}'::jsonb) gives this error operator does not exist: jsonb || jsonb I'm using psql (9.4.19)

Also this sql statement coalesce(nullif(current_setting('http_client.connect_timeout', true), ''), '2')::integer gives this error No function matches the given name and argument types. You might need to add explicit type casts I change it to coalesce(nullif(current_setting('http_client.connect_timeout'), ''), '2')::integer, and it worked

Thanks

NikolayS commented 6 years ago

@jcleiva, thank you for your comments!

The operator || for jsonb and json types was added only in Postgres 9.5.

As for current_setting(..) function, its second parameter was added in 9.6, and it's very helpful because it allows defining "default" value.

I'm afraid, I won't be able to add backward compatibility for Postgres versions < 9.6 due to lack of time.

Can you upgrade?

NikolayS commented 6 years ago

FYI: I've added a note to README, that postgres 9.6+ is required.

jcleiva commented 6 years ago

Thanks for your reply, Ok, I will try it using postgresql 10.

I will let you know

Thanks again.