go - Passing arguments from GOLANG to CROSSTAB WHERE CLAUSE of Postgresql -


hi iam facing difficulty in passing arguments postgresql's crosstab function golang.

below code:

row, err := db.query("select * crosstab( 'select student, subject, evaluation_result evaluations evaluation_result > $1 order 1,2') final_result(student text, geography numeric,history numeric,language numeric,maths numeric,music numeric)", pass_mark) if err != nil {     fmt.println("error", err)     return } defer sql.close(row) _, data1, err := sql.scan(row) if err != nil {     fmt.println("error", err)     return } if len(data1) <= 0 {  } else if len(data1) <= 0 {     fmt.println("error", "no data found")     return } fmt.println("data", data1) 

iam getting following error:

pq: bind message supplies 1 parameters, prepared statement "" requires 0 

it giving error because $1 not identified variable argument since present inside '' (the single quotes of crosstab function)

how can pass argument?


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -