Re: Issue while calling new PostgreSQL command from a Java Application
От | Ashutosh Bapat |
---|---|
Тема | Re: Issue while calling new PostgreSQL command from a Java Application |
Дата | |
Msg-id | CAFjFpRdK2ah5u0-v+JD1zszYKiRoXLERitM15okpyiM=+ttSaA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Issue while calling new PostgreSQL command from a Java Application (Ashoke <s.ashoke@gmail.com>) |
Список | pgsql-hackers |
Thank you Ashutosh. That was the issue. But, could you please explain why it worked from command line?
--On Fri, Jul 4, 2014 at 11:49 AM, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:You may have to add code to copy inp_str to _copyVacuumStmt(). See how a character array being copied from other _copy* functions.--On Fri, Jul 4, 2014 at 10:43 AM, Ashoke <s.ashoke@gmail.com> wrote:Hi,
------------------------------
I have defined a new command
my_command
in PostgreSQL. This command takes the path ofANALYZE
and insideanalyze.c
, I have a function to do some operations if itsmy_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 functionstandard_ProcessUtility()
ofutility.c
for the caseT_VacuumStmt
, I get the value as NULL. This is as far as I could trace back fromanalyze.c
.I am not sure how executing the same command from an application can make a difference.
gram.y content gist:
MyStmt: my_keyword qualified_name name_list my_inp_str { VacuumStmt *n = makeNode(VacuumStmt); n->options = VACOPT_ANALYZE; n->freeze_min_age = -1; n->freeze_table_age = -1; n->relation = $2; n->va_cols = $3; n->inp_str = $4; fprintf (stderr, "I am inside gram.y %s\n",n->inp_str); $$ = (Node *)n; } ;
char *inp_str
is added to thestruct VacuumStmt
inparsenodes.h
---------------------------
Only the newly added
char *inp_str
(that is different fromANALYZE
) value is NULL. I was able to retrieve the column name fromva_cols.
Any help is appreciated. Thanks!--
Regards,
AshokeBest Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company
Regards,
Ashoke
--
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company
В списке pgsql-hackers по дате отправления: