can you please point at my mistake? im doing ``` w...
# off-topic
g
can you please point at my mistake? im doing
Copy code
with au as (SELECT set_config(
  'request.jwt.claims',
  '{ "sub": "MY UID from auth table ", "email": "MY EMAIL from auth table" }',
  false
))
select * from auth.uid();
and it always returns
null
c
WITH-statments are generally used with common table expressions (CTEs) in order to setup something like a temporary table which you can then use in a select
I am not very familiar with the actual semantics of WITH statments, but set_config is a system function (NOT a temporary table you setup) so I am not sure how that interacts with the WITH statement
if you run the 2 selects as separate statments, you will no longer get null - of course, this will set your uid/email for the duration of your connection to the db (only your connection, that is, other users should NOT be affected as far as I know)
you still have the option of using SET LOCAL if you want to change the uid/email only during a particular transaction
g
Hm. I thought each select overwrites the previous select in supabase.io dashboard
c
the Supabase dashboard is just a client in order to interact with the PostgreSQL database - it does NOT modify the actual behavior of the database. That is, regardless of whether you use the Supabase dashboard or another client to connect to the DB (e.g. pgAdmin, TablePlus, Datagrip, etc), you would get the exact same behavior. The only possible difference is that the Supabase dashboard uses the supabase_admin user by default so you get permission to do more things
g
Copy code
SELECT set_config(
  'request.jwt.claims',
  '{ "sub": "...", "email": "..." }',
  false
);
select * from auth.uid();
returns
Success. No rows returned
that's what i meant.
individually they do return results; however if i run the first expression and then separately the second the output is column uid with "null" value
should i avoid using supabase dashboard?
c
ok, I see what you are saying, I cannot tell you why it behaves like that...it seems like a bug to me
I personally don't use the dashboard because I find that using a dedicated desktop client both more convenient and more reliable
(I mean I don't use it for interacting with the DB, there are still some things that you can only do from the dashboard like modifying certain settings)