plpgsql函数文本连接错误

时间:2011-02-28 13:38:08

标签: postgresql plpgsql

以下任何一项都可以正确陈述吗?

strdir := 'copy '
          || t_name.relname
          || ' from E'''' || C: || '''''
          || t_name.relname || '''.txt'' using delimiters '|'';

2 个答案:

答案 0 :(得分:1)

strdir := 'copy '
          || t_name.relname
          || ' from E''C:"'  -- one ' to many here, included C:, which had no '
                             -- and I suspect you need a double quote here "
          || t_name.relname
          || '".txt'' using delimiters ''|'''; -- closing ", double ' around |

答案 1 :(得分:0)

我认为最后一个|的单引号应该是两个单引号。