On Wed, Mar 21, 2007 at 02:20:21AM +0000, hu js wrote: > But I get into another trouble.See following program.
As I requested before, please post questions to the mailing list so others can participate in and learn from the discussion. > "query_xypos" is ok. but "query_xydata" is not ok. > I find "objectid" not quoted corrected.It seems relevant with variable > varchar and "'". [...] > query_xypos text := 'SELECT mrc_xy_position FROM ' || > quote_ident(tablename); > query_xydata text := 'SELECT x,y FROM ' || tablename || ' where > mrc_xy_position = ' || quote_ident(objectid) ; See the documentation to learn more about quote_ident() and quote_literal() and when to use each: http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN http://www.postgresql.org/docs/8.2/interactive/functions-string.html#FUNCTIONS-STRING-OTHER -- Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend