sql - How can I update a single field in psql with the contents of a file? -


I am trying to do the following: bodycontent set body = CONTENT_FROM_FILE where Contentid = 12943363;

I have tried the following on the basis of the least answer given. contentfill cat cat.Foo.txt updated bodycontent body = = 'contentfill' where content = 12 9 43363;

The result is the following error.

  error: syntax error "on or near": "line1: update bodycontent body =: 'contentfill' where contentid = 1 ...   < P> What is a clean, simple, and effective way to achieve this on the  psql command line?         

After more searching, I came to know, which does not directly discuss the problem of reading the file, but gives me the necessary components for it. My old PostGrace .

  \ content This work for the updated bodystructure SET body: `cat foo.txt` \ set quoted_contentFill '\': contentFill '=': quoted_contentFill WHERE contentid = 12 943363;   

Naturally, If it escapes the quote marks inside Foo.txt , it will fail, but I can easily pre-process it to ensure no one is.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -