Code Monkey home page Code Monkey logo

Comments (10)

wolfgangwalther avatar wolfgangwalther commented on September 27, 2024

If SET LOCAL "request.header.user-agent" TO "curl/7.78.0"; is not supported by your PostgreSQL version / fork, then I think you're out of luck. This seems to be very specific to that fork.

from postgrest.

wolfgangwalther avatar wolfgangwalther commented on September 27, 2024

You can try if SELECT set_config('request.header.user-agent', 'curl/7.78.0', true); works better, though.

from postgrest.

gjevardat avatar gjevardat commented on September 27, 2024

SELECT set_config('request.header.user-agent', 'curl/7.78.0', true);

This one works indeed

SET LOCAL "request.header.user-agent" TO "curl/7.78.0" works as well

But not : SET LOCAL request.header.user-agent TO "curl/7.78.0" i.e without the surrounding double quotes which is the actual query generated. (I did a typo in my initial issue - will edit)

from postgrest.

wolfgangwalther avatar wolfgangwalther commented on September 27, 2024

SET LOCAL "request.header.user-agent" TO "curl/7.78.0" works as well

If that works, then this is not a problem, I think. It would fail without the quotes on all postgresql versions anyway.

So the problem seems to be somewhere else. Which error are you actually getting and where?

from postgrest.

gjevardat avatar gjevardat commented on September 27, 2024

Thanks for your quick reply:

Here is my error in the logs postgres logs:

STATEMENT: SET LOCAL transaction_isolation TO "read committed";SET LOCAL transaction_read_only TO "1";SET LOCAL search_path TO "dr4_ops_cs48", "public";SET LOCAL role TO jevardat_local;SET LOCAL request.jwt.claim.role TO username ;SET LOCAL request.method TO "GET";SET LOCAL request.path TO "/catalog";SET LOCAL request.header.host TO "localhost:3000";SET LOCAL request.header.user-agent TO "curl/7.78.0";SET LOCAL request.header.accept TO "/";SET LOCAL coordinator_lxid TO "390377";

ERROR: XX000: pgxc_node_set_query: nodename:dn1,backend_pid:351919,message:syntax error at or near "user",detail:,hint:
(no hint unfortunately)

I tried executing the statement and All SET LOCAL are working except the user-agent one !!
More precisely SET LOCAL request.header.user-agent does not work but SET LOCAL request.header.useragent does as well as when surrounded with ""

from postgrest.

wolfgangwalther avatar wolfgangwalther commented on September 27, 2024

Which PostgREST version is that exactly?

from postgrest.

gjevardat avatar gjevardat commented on September 27, 2024

Which PostgREST version is that exactly?

11.2.2 11.0.0 10.1.1 10.0.0 were all failing with similar error

from postgrest.

wolfgangwalther avatar wolfgangwalther commented on September 27, 2024

Hm. We have not used SET LOCAL for quite a while. We changed to set_config in 2020 for v8.0.0 in 7069bb3.

So either you are in fact unknowingly running a much older version of PostgREST or your PostgreSQL fork is doing something really, really odd.

from postgrest.

gjevardat avatar gjevardat commented on September 27, 2024

Hm. We have not used SET LOCAL for quite a while. We changed to set_config in 2020 for v8.0.0 in 7069bb3.

So either you are in fact unknowingly running a much older version of PostgREST or your PostgreSQL fork is doing something really, really odd.

So there is something weird look at my logs:
query=PostgREST 11.2.2,STATEMENT: SET LOCAL transaction_isolation TO "read committed";SET LOCAL transaction_read_only TO "1";SET LOCAL search_path TO "dr4_ops_cs48"

PostgREST 11.2.2 is being executed and generates SET LOCAL statements not set_config

I took the binary version here : https://github.com/PostgREST/postgrest/releases/download/v11.2.2/postgrest-v11.2.2-linux-static-x64.tar.xz

from postgrest.

gjevardat avatar gjevardat commented on September 27, 2024

Ok I just found that version 12.0.0 is working actually ! So issue can be closed.

Thanks for super fast feedback

from postgrest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.