prest
prest copied to clipboard
Update database
Good day.
Is it possible to make it so that when executing a PATCH query, the field is not overwritten in the database, but added to the end?
...
Can you give an example with what you trying to do so i can better understand your question?
Em seg, 22 de out de 2018 às 11:11, Aleksandr [email protected] escreveu:
Good day.
Is it possible to make it so that when executing a PATCH query, the field is not overwritten in the database, but added to the end?
...
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/prest/prest/issues/339, or mute the thread https://github.com/notifications/unsubscribe-auth/AEpfGcTLjF1d_1vz_Fvsnih1QeZirR5Hks5undH3gaJpZM4XzdK_ .
-- Felipe Oliveira https://www.felipeweb.net.br
For example, I have a table "test"
CREATE TABLE test ( test_id bigserial primary key, test_name varchar(20) NOT NULL, test_desc text NOT NULL, date_added timestamp default NULL );
Suppose in the field "test_desc" there is an entry "example", so here I want that when executing the query
curl -s -X PATCH -H "Content-type: application/json" -d '{"test_desc": "new text" }' 'http://127.0.0.1:8000/test_db/public/test?id=104'
in the "test_desc" field, the value of "example new text" has become
as does this sql query UPDATE test SET test_desc = CONCAT(test_desc, ' ', 'some_new_str') WHERE id =104 ;
pREST does not support COUNT function yet
Em ter, 23 de out de 2018 às 06:18, Aleksandr [email protected] escreveu:
For example, I have a table "test"
CREATE TABLE test ( test_id bigserial primary key, test_name varchar(20) NOT NULL, test_desc text NOT NULL, date_added timestamp default NULL );
Suppose in the field "test_desc" there is an entry "example", so here I want that when executing the query
curl -s -X PATCH -H "Content-type: application/json" -d '{"test_desc": "new text" }' 'http://127.0.0.1:8000/test_db/public/test?id=104'
in the "test_desc" field, the value of "example new text" has become
as does this sql query UPDATE test SET test_desc = CONCAT(test_desc, ' ', 'some_new_str') WHERE id =104 ;
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prest/prest/issues/339#issuecomment-432166952, or mute the thread https://github.com/notifications/unsubscribe-auth/AEpfGd3iKqt9E4rBsI37sBkpeq8BUhAJks5unt7egaJpZM4XzdK_ .
-- Felipe Oliveira https://www.felipeweb.net.br
not COUNT bat CONCAT
sorry support COUNT, but not CONCAT
@AlexIskander you propose some REST signature for CONCAT? COUNT example: https://postgres.rest/query-statements/#select-get
Are you understand difference between COUNT and CONCAT?
@AlexIskander unfortunately we don't have the behavior you want, but you can use sql scripts instead. Look at https://postgres.rest/executing-sql-scripts/
Thinking more about your doubt I don't know if it's feasible to implement it because in your example you're consjuder just string datatypes, but what if we need to "concat" numeric, date, time, interval, or others datatypes ?? If so we'll need to implement a "concat" behavior for each kind of target datatype.