By David Crowther
How do you replace values in a field in a PostGIS table?
To replace a set of existing values with an alternate string of text, you can use an UPDATE statement.
For example, you may have a field that contains the location of Image files (or PDFs etc…),. the field in this case is called – new_url.
In this example we wish to replace the reference to the C Drive and instead just have the name of the file e.g. B-R-2-5b.tif. To do this you can use the syntax below:
… here we have searched for a value and replaced it with blank – using
The result will be that the new_url field is now updated to remove the location value, replacing it with ‘nothing’ and so you will be left with just the file name:
Another example could be that you wish to change the reference to the file from an IMAGE (.tif) to a DOCUMENT (.pdf)
… once ran, each record will now be referencing a .pdf instead of a .tif.