I'm using postGIS, and I'm not very familiar with SQL.
I can successfully insert into my markers table as long as I do something like this (pseudocode!):
'INSERT INTO markers(created_by, title, description, lat, lng, geography)\
values($1, $2, $3, $4::decimal, $5::decimal, ST_SetSRID(ST_MakePoint($5::decimal, $4::decimal), $6))',
[
data.created_by,
data.title,
data.description,
data.lat,
data.lng,
4326
]'
As you can see, I am doing ST_SetSRID(ST_MakePoint($5::decimal, $4::decimal), $6) from my application code.
I want to avoid that, and instead put this on the database side. Since I can do things like auto time stamps on the db side, I'm wondering if I can also do ST_SetSRID(ST_MakePoint(lng, lat), 4326) on the table itself.
This way, the application only needs to provide lat and lng, and the database will do the ST_SetSRID(ST_MakePoint()) operation.
Thanks
Edit: I'm not sure whose answer to mark as +1 since both offered tremendously good help and advice. I hope future readers will read both and hopefully learn something!