Re: Trigger (C) question - Mailing list pgsql-general

From Tom Lane
Subject Re: Trigger (C) question
Date
Msg-id 15833.962209244@sss.pgh.pa.us
Whole thread Raw
In response to Trigger (C) question  ("Mitch Vincent" <mitch@venux.net>)
List pgsql-general
"Mitch Vincent" <mitch@venux.net> writes:
> sprintf(query, "INSERT INTO %s (string, id) VALUES ($1, $2)", indexname);

> The above makes the query string, as I can see but what in the world is the
> $1 $2 and where did they come from?

Parameters.  The chunk of code you quote shows the plan being set up
with two parameters, the first of type VARCHAR and the second of type
OID (this allows the parser to know what datatype conversions it might
need to apply).  The actual values of the parameters will get passed to
the executor when the plan is executed, later on.  Too lazy to go
looking for the details right now...

            regards, tom lane

pgsql-general by date:

Previous
From: Christophe Doré
Date:
Subject: 2 phase commit
Next
From: Ted Nolan SRI Augusta GA
Date:
Subject: Re: DateTime fields