https://supabase.com/ logo
Join Discord
Powered by
# sql
  • h

    hamishcoding

    07/29/2021, 5:31 PM
    Yea I meant one column, in a row
  • a

    Azura

    07/29/2021, 5:31 PM
    You can check out this post: https://supabase.io/docs/reference/javascript/update
  • s

    silentworks

    07/29/2021, 5:31 PM
    Relational databases are not intended to work this way, however you can do it, look at this thread and you should find an answer there https://github.com/supabase/supabase/discussions/1570
  • h

    hamishcoding

    07/29/2021, 5:31 PM
    ok thanks guys!
  • h

    hamishcoding

    07/29/2021, 5:34 PM
    thanks man, this link helped me. I got it working now.
  • e

    ehesp

    07/29/2021, 6:37 PM
    Hello,
  • e

    ehesp

    07/29/2021, 6:37 PM
    Does anyone know how to delcare and use a variable in a trigger - this is erroring:
    Copy code
    create or replace function public.create_project_on_new_user() 
    returns trigger as $$
    declare
      new_project_id uuid;
    begin
      new_project_id = uuid_generate_v4();
      -- insert into public.profiles (id, project) values (new.id, ''); 
      -- insert into public.projects (id, type, name) values (new_project_id, 'PERSONAL', '...');
      -- insert into public.profiles_projects (profile_id, project_id) values (new.id, new_project_id);
      return new;
    end;
    $$ language plpgsql security definer;
    s
    k
    • 3
    • 4
  • e

    ehesp

    07/29/2021, 6:38 PM
    The inserts are commented out for now, but the declaration of a variable just fails - can't see any logs as the client throws a generic error
  • j

    jon.m

    07/29/2021, 7:49 PM
    Hello Everyone - Just to follow up on my earlier message, does anyone have any insight?
    b
    • 2
    • 31
  • r

    ricpt

    07/30/2021, 12:00 AM
    Hello guys, I'm having issues with multitenant configuration. Trying the example on the docs
  • r

    ricpt

    07/30/2021, 12:00 AM
    Any tips?
  • s

    Scott P

    07/30/2021, 12:04 AM
    Is your
    auth.users.id
    definitely a
    uuid
    type (it is by default, but better to check)? You should be able to run
    SELECT column_name, data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users' AND table_schema = 'auth'
    to check
  • r

    ricpt

    07/30/2021, 12:09 AM
    even if I specify the auth.user.sid
  • s

    Scott P

    07/30/2021, 12:12 AM
    That's really strange. If you run the same command from something like pgadmin, or even the Supabase SQL dashboard (unless this is the dashboard, in which case try pgAdmin or similar), does it still show the same error?
  • r

    ricpt

    07/30/2021, 12:13 AM
    I'm running on the Sapabase SQL dashboard.
  • r

    ricpt

    07/30/2021, 12:13 AM
    Tried on DataGrip as well but I receive permission.denied for table users. (however I can create tables that doesn't do references between postgres databases)
  • r

    ricpt

    07/30/2021, 12:14 AM
    the credentials are correct and I can create the connection
  • s

    Scott P

    07/30/2021, 12:17 AM
    I know that some older projects had the Postgres user as a superadmin of the DB and could do anything, but somewhere along the way, it got changed so it's not superadmin. It might be worth opening a bug report in the repo, or a discussion so that other people can add their thoughts. I've just tested your example query on a recently created (~3 days ago) project, and it didn't throw any errors for me 🤔
  • r

    ricpt

    07/30/2021, 12:21 AM
    found the issue. Went hard mode.
  • r

    ricpt

    07/30/2021, 12:21 AM
    Query by query. It was a mistake in a specific query. The id comparison of the policy was wrong
  • r

    ricpt

    07/30/2021, 12:21 AM
    thanks for the tips @User
  • l

    lawrencecchen

    07/30/2021, 1:36 AM
    How do I refresh the postgrest schema? updated some columns and it's not showing up in the generated openapi
  • h

    hieu

    07/30/2021, 1:44 AM
    can you try this
  • l

    lawrencecchen

    07/30/2021, 1:44 AM
    nvm, found
  • l

    lawrencecchen

    07/30/2021, 1:44 AM
    oh lol
  • l

    lawrencecchen

    07/30/2021, 1:44 AM
    there's a button, thanks for that!
  • l

    lawrencecchen

    07/30/2021, 1:45 AM
    does that restart the entire db or just refresh the postgrest schema?
  • h

    hieu

    07/30/2021, 1:45 AM
    it will be entire db. So if the SQL works, then you should use that
  • s

    sylar815

    07/30/2021, 11:32 AM
    Is there any recommend way to structure a multi lingual blog architecture on postgress/ supabase.
  • k

    Kosh

    07/30/2021, 11:43 AM
    not so experienced with blogs, but maybe something like table blogs -> id, date, author content table -> locale (en_en), blog_body, blogId just an idea tho. then u could do something like select content.stuff, blog.stuff from content inner join blogs on id = blogId where locale = user_locale
12345...52Latest