Thank you Ashutosh. That was the issue. But, could you please explain why it worked from command line?
I do not know. Any time we add a member to a node and find it's value coming out NULL or 0 instead of the one set, corresponding _copy* is the first suspect. You may be able find why it worked in command line and why not through the connector by breaking on copyObject() in either cases.
I have defined a new command my_command in PostgreSQL. This command takes the path of ANALYZE and inside analyze.c, I have a function to do some operations if its my_command.This command takes the input arguments: table name, column name and an input string.
my_command nation (n_nationkey) 'input string';
When I run this command from command line psql, it works as expected. But when I call the same command from a java application, the variable that stores the input string is NULL.
I printed the value of the input string in gram.y file where I have defined my_command. fprintf (stderr, "I am inside gram.y %s\n",n->inp_str); and the input string is printed correctly.
But when I print stmt->inp_str in the function standard_ProcessUtility() of utility.c for the case T_VacuumStmt, I get the value as NULL. This is as far as I could trace back from analyze.c.
I am not sure how executing the same command from an application can make a difference.