tabs and newlines not quoted in pgconn_insert_table

Issue #3 invalid
Michael Granger repo owner created an issue

Via Perry Smith in [[|Rubyforge bug 22954]]:

I am not sure about the intent of the code but when I do insert_table, I have to pre-process my strings and change the tabs to \t (two characters) and newlines to \n. It appears as if this code:



} else { s = rb_obj_as_string(row->ptr[j]); rb_funcall(s,pg_gsub_bang_id,2, rb_str_new("([\t\n\\])", 10),pg_escape_str); rb_str_cat(buffer, StringValuePtr(s), RSTRING_LEN(s)); } }}}

is attempting to do that for me but it does not seem to be working.

One thought is you are doing {{{rb_str_new}}} and perhaps you need to create a regexp instead of a string.

In any case, on Postgres 8.3.2, it was not working. A stray new line prematurely terminated the list of fields and a stray tab created too many fields.

Comments (2)

  1. Michael Granger reporter

    The 'pg' library doesn't have an #insert_table method, so I'm assuming it was part of the 'postgres' library. Regardless, the 'pg' library doesn't contain the string this bug cites as a problem, so I'm closing it. Feel free to open a new ticket if the problem still exists in a different form.

  2. Log in to comment