我正在尝试从完整路径中获取路径并将其复制到新列中,但我很难管理引号。 我有一列带有"/volume2/test/这里是/我的文件.avi",我想在另一列中复制"我的文件.avi (我也喜欢路径,但我会在之后检查( 有人可以帮忙吗?
/usr/bin/psql -U postgres video_metadata -q -A -t -c """SELECT RIGHT(path, POSITION('' in REVERSE(path)) -1 ) from video_file;""""
但我有这个错误
syntax error near unexpected token `('
如果我尝试一些更干净的东西,比如
/usr/bin/psql -U postgres video_metadata -q -A -t -c "SELECT RIGHT(path, POSITION('' in REVERSE(path)) -1 ) from video_file;"
我有这个错误
ERROR: unterminated quoted string at or near "'' in REVERSE(path)) -1 ) from video_file;"
LINE 1: SELECT RIGHT(path, POSITION('' in REVERSE(path)) -1 ) from ...
我想你的意思是:
/usr/bin/psql -U postgres video_metadata -q -A -t -c "SELECT RIGHT(path, POSITION('' in REVERSE(path)) -1 ) from video_file;"
发现....我混淆了窗户路径.....它应该是"/"而不是"\">
完整的命令将是:
/usr/bin/psql -U postgres video_metadata -q -A -t -c "SELECT RIGHT(path, POSITION('/' in REVERSE(path)) -1 ) from video_file;"