Add a method to send a placeholder value to the su...
# ideas-and-suggestions
y
Add a method to send a placeholder value to the supabase database server so that it can fill it with the timestamp when the server received the request. Kinda like firestore.FieldValue.serverTimestamp() For context: - https://firebase.google.com/docs/reference/js/v8/firebase.firestore.FieldValue
s
Isn't this just setting the column value to
NOW()
by default when creating the table?
s
Otherwise If I remember correctly you can pass
NOW()
as a value with the
.insert
function
y
I don't think that should be possible, that would mean the value has to be evaluated on the database side right? Wouldn't that also mean I would be able to literally write SQL via the client sdk?
unless while creating the AST when parsing the postgrest query they've got something to identify now() and run it seperately or smthing, which would kinda be the same thing as what i mentioned in the comment
s
Test and see
No not all SQL work with the client SDK, but I think
NOW()
is one of those which works.
y
I'm not really near my computer rn, so it'll have to wait I guess
s
PostgREST doesn't do anything special with
now()
. It's just that PostgreSQL has some special string values for timestamp/tz:
Copy code
sql
select 'now'::timestamptz;

select 'yesterday'::timestamptz;

select 'tomorrow'::timestamptz;
All of those work.
s
Same goes for
insert
right?
s
Yes