Re: [SQL] Data Loss from SQL SELECT (vs. COPY/pg_dump)

2013-04-05 Thread Kong Man
This seems to answer my question. I completely forgot about the behavior of NULL value in the text concatenation. http://www.postgresql.org/docs/9.1/static/plpgsql-statements.html#PLPGSQL-QUOTE-LITERAL-EXAMPLE Because quote_literal is labelled STRICT, it will always return null when calle

[SQL] Data Loss from SQL SELECT (vs. COPY/pg_dump)

2013-04-05 Thread Kong Man
I am troubled to find out that a SELECT statement produces fewer rows than the actual row count and have not been able to answer myself as to why. I hope someone could help shedding some light to this. I attempted to generate a set of INSERT statements, using a the following SELECT statement,