Brian
05/18/2023, 5:24 PMCREATE
or REPLACE FUNCTION create_signature_code()
returns trigger as $$
begin
UPDATE public.signature_activity
SET signature_code = '1234'
WHERE id = new.id
return new;
end;
$$ language plpgsql security definer;
create trigger on_new_signature_activity
after insert on public.signature_activity
for each row execute procedure public.create_signature_code();
Failed to run sql query: syntax error at or near "return"formigueiro
05/18/2023, 5:48 PMhttps://cdn.discordapp.com/attachments/1108813485023952996/1108817302650101760/image.png▾
iano
05/18/2023, 5:53 PMcbunge3
05/18/2023, 6:56 PMYuu
05/18/2023, 7:27 PMjinsley8
05/18/2023, 8:33 PMformigueiro
05/18/2023, 8:52 PMjs
const { data, error } = await supabase
.from("url_data")
.select('*, clicks(*)')
.eq('slug', slug)
.single()` i have items clicks with the same url_data id but its returning []
https://cdn.discordapp.com/attachments/1108859680815587480/1108859681306325022/image.png▾
https://cdn.discordapp.com/attachments/1108859680815587480/1108859681646067802/image.png▾
jpow's_printer
05/18/2023, 9:34 PMzj
05/18/2023, 9:53 PM<hmmhmmhm/>
05/18/2023, 11:04 PMedgaras
05/19/2023, 12:13 AMbonglv
05/19/2023, 12:17 AMlampaboy
05/19/2023, 1:16 AMpostgress_change when subscribed to the channel, but that just updates the form when there is a change in db on not vice versa.
Thoughts of an own implementation would be to self implement a debounce rate and a mix of insert and upsert calls to track the change of the form state before loading it into db onChange. Doing this with nextJS.
Any feedback regarding the implementation or reusable patterns are also much appreciated.user8923
05/19/2023, 2:26 AMuser8923
05/19/2023, 2:49 AMninjashrimp
05/19/2023, 6:31 AMpostgres:
container_name: postgres
image: supabase/postgres
platform: linux/arm64
healthcheck:
test: pg_isready -U postgres -h localhost
interval: 5s
timeout: 5s
retries: 10
command:
- postgres
- -c
- config_file=/etc/postgresql/postgresql.conf
- -c
- log_min_messages=fatal # prevents Realtime polling queries from appearing in logs
restart: unless-stopped
ports:
# Pass down internal port because it's set dynamically by other services
- "5432:5432"
environment:
# POSTGRES_HOST: /var/run/postgresql
# PGPORT: ${POSTGRES_PORT}
# POSTGRES_PORT: ${POSTGRES_PORT}
# PGPASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_PASSWORD: postgres
# PGDATABASE: ${POSTGRES_DB}
# POSTGRES_DB: ${POSTGRES_DB}
volumes:
- ${STORAGE_ROOT}/data/postgres/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z
# Must be superuser to create event trigger
- ${STORAGE_ROOT}/data/postgres/webhooks.sql:/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql:Z
# Must be superuser to alter reserved role
- ${STORAGE_ROOT}/data/postgres/roles.sql:/docker-entrypoint-initdb.d/init-scripts/99-roles.sql:Z
# PGDATA directory is persisted between restarts
- ${STORAGE_ROOT}/data/postgres/data:/var/lib/postgresql/data:Zkrzychu
05/19/2023, 6:35 AMJinni
05/19/2023, 6:53 AMhttps://cdn.discordapp.com/attachments/1109011030987780126/1109011031201677414/image.png▾
https://cdn.discordapp.com/attachments/1109011030987780126/1109011031541420052/image.png▾
thevelop
05/19/2023, 7:47 AMmilly
05/19/2023, 8:04 AMAkkilah
05/19/2023, 9:09 AMUPDATE auth.users
SET role = 'webadmin'
WHERE email = 'akxxxxxx@gmail.com';
Additionally, I granted the 'webadmin' role to the 'authenticator' user by executing the following command:
GRANT webadmin TO authenticator;
So can i have any advice ?
https://cdn.discordapp.com/attachments/1109045181711384606/1109045181908529192/1.PNG▾
https://cdn.discordapp.com/attachments/1109045181711384606/1109045183334580254/2.PNG▾
tgps26
05/19/2023, 9:49 AMws
05/19/2023, 10:05 AMhttps://cdn.discordapp.com/attachments/1109059316759134218/1109059317501546516/image.png▾
zj
05/19/2023, 12:14 PMEKI
05/19/2023, 12:22 PMTheRien
05/19/2023, 12:37 PMmurko
05/19/2023, 12:42 PMconnections with the following structure:
table connections
id | user_id | data
where user_id is a foreign key pointing to auth.users.id.
Now I want to insert a new record via Javascript to the connections table (it's only possible when the user is authenticated):
js
const { data, error, ...rest } = await supabase
.from("connections")
.insert({
data
})
What I would like to happen is that user_id would be inserted automatically based on the currently authenticated user - basically just inserting auth.uid().
Unfortunately, I can't figure out how to achieve that without me manually passing the data in the payload like so:
js
const { data, error, ...rest } = await supabase
.from("connections")
.insert({
data,
user_id: supabase.getSession().session.user.id
})
which doesn't seem right...
I was thinking of creating a trigger that adds the user_id after the connection record is created but I don't know how to retrieve the currently authenticated user's ID in a trigger.
Any help would be highly appreciated! Thank you!Tinog
05/19/2023, 12:56 PMzj
05/19/2023, 1:05 PMCrembo
05/19/2023, 2:24 PMcross join between a pair of million row generate_series-es and crashing the server due to RAM/disk exhaustion?