The problem in the second call to ST_LineFromText() is that you are attempting to pass parameters into it, which isn't possible. You have:
ST_LineFromText('linestring (0 0,v1.pre 0,v1.pre v1.post,0 v1.post,0 0 )',5)
The string contains 'v1.pre' which is not a valid number, etc. If you need to parameterize your query, you either need to generate the string with those values in place, or you need to use a different method. One crude but possible solution is:
ST_LineFromText('linestring (0 0,' || v1.pre || ' 0,' || v1.pre || ' ' ||
v1.post || ',0 ' || v1.post || ',0 0 )', 5)
This may not do the job - but illustrates the problem.