Reputation: 785
I have a table that has a column, file_name
. I added file names that contain underscores using insert
. Upon select
I see spaces where the underscores should be. Apparently the underscore is used for formatting and needs to be escaped.
What is the proper way to insert
values with underscores?
How can I update
the values with spaces by replacing all spaces with underscores?
What is the proper way to select
a row using where
when the value has an underscore, such as where file_name = "some_file.txt"
In other words, how and when does the underscore need to be escaped?
Upvotes: 1
Views: 870
Reputation: 121784
There is no need to escape underscores in string literals in Postgres. See this example. Your case may be caused by a strange behavior of client application. Test your queries in psql.
Upvotes: 1