vjoohov
11/17/2022, 12:55 PMFunHellion
11/17/2022, 1:16 PMsql
create or replace function update_claims_member_schemas()
returns trigger as
$$
declare
nothing text;
begin
select update_user_claims(new.user_id) into nothing;
select update_user_claims(old.user_id) into nothing;
return new;
end;
$$
language plpgsql security definer;
create trigger user_roles_update_user_claims after delete or insert on user_roles
for each row execute
procedure update_claims_member_schemas(user_id);
I have to execute the function for new and old now because an insert gives an object called new
and a delete gives an object called old
.
Because this seems incorrect I was wondering if there is a better way to do this. Is there an object which is always available or is this the correct way?
Thanks in advance!rohangroombridge
11/17/2022, 1:21 PMsigma-andex
11/17/2022, 2:02 PM➜ supabase start
Applying migration 20221117135052_remote_commit.sql...
Error: ERROR: relation "graphql.schema_version" does not exist (SQLSTATE 42P01)
At statement 113:
--
-- Name: TABLE "schema_version"; Type: ACL; Schema: graphql; Owner: supabase_admin
--
GRANT ALL ON TABLE "graphql"."schema_version" TO "postgres";
In the migration I also cannot see an create table statement for this table. Any idea how I can fix this issue?NanoBit
11/17/2022, 2:42 PMkobyisalegend
11/17/2022, 2:59 PMbeta
/app directory in nextjs13 at the moment).
Here is a stripped down snippet of my "problem":
javascript
export const getServerSideProps = async({ params }) => {
const { data: board, error } = await supabase
.from('boards')
.select('*')
.eq('id', params.id);
return {
props: {
board,
},
};
}
export default function CategoryPage({ board }) {
return (
<h1>Test</h1>
);
}
params.id
is correct and also the query seems fine if i try it at any other place. But in this example the result of board
is at anytime an empty array and i have no idea why.
I also tried a default fetch request with an example json - that result is correct and works.:
javascript
const req = await fetch('https://jsonplaceholder.typicode.com/todos/1');
const result = await req.json();
has someone here an idea why this is not working and what i'm doing wrong here? i also tried it with getStaticPaths & getStaticProps - this lead into the same problem and empty array situation.raph941
11/17/2022, 3:16 PMmagicseth
11/17/2022, 4:37 PMsupabase
.channel('public:messages')
.on('postgres_changes', {
event: 'INSERT',
schema: 'public',
table: 'messages',
filter: "and(from.eq.${from},to.eq.${to})"
}, gotNewMessage)
.subscribe(console.log)
andriusmv
11/17/2022, 4:44 PMismael1234
11/17/2022, 5:08 PMadolfoportilla
11/17/2022, 5:20 PMwithPageAuth
on a page that I want to protect, this causes a timeout when I go to the page on Vercel. When I inspect the deployment, I see that the page is being added as a “Serverless Function”, is this expected?puffer
11/17/2022, 5:37 PMconst { data, error } = await supabase
.from("myTable")
.insert({
first_name: firstName,
last_name: lastName,
address: addressOne,
city: cityOne,
address_two: addressTwo,
state_province_region: stateProvince,
zip_postal_code: zipPostal,
country: countryOne,
email_address: emailAddress,
phone_number: phoneNumber,
message: messageOne,
})
.select();
My return object not sure how to access data I have been trying things like data.first_name, below is my return object. Thank you for any helpUnknown Member
11/17/2022, 5:56 PMSiddharth
11/17/2022, 6:04 PMgerry
11/17/2022, 6:25 PMconst { data, error } = await supabaseAdmin.auth.api.generateLink(
'magiclink',
internalUserEmail,
{
redirectTo: ROOT_URL,
},
)
The error object is attached in the image.
Customer Support said they increased the max pool size as a temporary fix but that did not make a difference and they have been unresponsive since.rankala
11/17/2022, 6:52 PMmr fluffhead
11/17/2022, 7:13 PMdan_v
11/17/2022, 8:15 PMtrip
I currently have a column called destinations
which contains an array of objects as a type json
. Ideally this should probably be a nested table of some sort (?) so it can be full typed etc. However I'm not sure what the best approach is for setting this up, querying and RLS.Ivan Kartashov
11/17/2022, 8:49 PMtext
"url": "https://krppyyichhwmuvastgik.supabase.co/rest/v1/kisis_forms?select=%2A&tg_id=not.in.%28%22547384285%22%2C...
AND OTHER VALUES......"
So it's too big. How could I fix that? I have no options:
1. This array represents cached values
2. I must only show user the data that hasn't seen previously (means not in that big array of cached values)
3. Then it means that I could only fetch with a filter that basically says COLUMN not in (a lot of IDs). Request is going to be huge anyways.Julian IncrEdelman
11/17/2022, 8:55 PM2022/11/17 15:50:21 PG Recv: {"Type":"ErrorResponse","Severity":"ERROR","SeverityUnlocalized":"ERROR","Code":"42883","Message":"function graphql.get_built_schema_version() does not exist","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"parse_func.c","Line":2444,"Routine":"LookupFuncWithArgs","UnknownFields":null}
2022/11/17 15:50:21 PG Recv: {"Type":"ReadyForQuery","TxStatus":"I"}
2022/11/17 15:50:21 PG Send: {"Type":"Terminate"}
Error: ERROR: function graphql.get_built_schema_version() does not exist (SQLSTATE 42883)
At statement 107:
--
-- Name: FUNCTION "get_built_schema_version"(); Type: ACL; Schema: graphql; Owner: supabase_admin
--
GRANT ALL ON FUNCTION "graphql"."get_built_schema_version"() TO "postgres";
LordZardeck
11/17/2022, 9:05 PM::money
, but the typescript definition comes through as unknown
. Is there a way to fix this?Lukas V
11/17/2022, 9:09 PMXenni
11/17/2022, 10:41 PMsupabase gen types
always seems to have each column of the view be nullable.
Is this simply an implementation detail that's hard to overcome or?konga
11/18/2022, 12:55 AMschedule
and that is the direct table that I am querying. schedule
table has a one to many relationship with schedule_details
(basically there's one schedule
and 7 schedule_details
one for each day).
I am trying to do a foreign key filter by calling .eq("schedule_details.purchase_day", day)
with day = whatever day it is. Supabase is returning the following error "column schedule.schedule_details.purchase_day does not exist"
.
Any thoughts?paxmx
11/18/2022, 1:16 AMMx
11/18/2022, 1:58 AMSmardrengr
11/18/2022, 2:30 AMcreate table games (
id uuid primary key DEFAULT gen_random_uuid(),
name text,
players_min int default 0,
players_conf int default 0,
game_on boolean not null default false
);
I want to change game_on
to true
when players_conf
(confirmed) is equal to or greater than players_min
. (Conversely, if players_conf
becomes less than players_min
, game_on
should be changed to false
.) Basically, on update
, I want to run this condition and potential update to run. But... how. Still learning PGSQL
.ZebraCoder
11/18/2022, 10:10 AMppt
11/18/2022, 10:13 AMShawn Conecone
11/18/2022, 11:02 AM