Обсуждение: Passing an argument to a trigger function using tg_argv
Hi, I'm having an issue which is saying I can't pass the variable to the trigger function but I'm not sure what I am doing wrong.You can see my source code here: https://gist.github.com/simonconnah/9ddd257198d799230a1689aa855d08d5 I really don't have a clue about what I am doing wrong. Simon.
Вложения
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Wednesday, March 31st, 2021 at 10:55, Simon Connah <simon.n.connah@protonmail.com> wrote: > Hi, > > I'm having an issue which is saying I can't pass the variable to the trigger function but I'm not sure what I am doingwrong. You can see my source code here: > > https://gist.github.com/simonconnah/9ddd257198d799230a1689aa855d08d5 > > I really don't have a clue about what I am doing wrong. > > Simon. There seems to be a weird bug with my code which I can't figure out. I get the following error message since adding the triggerand the trigger function. error: invalid input syntax for type bigint: "blog_user_id" but I am unsure how to go about diagnosing the problem. If anyone could offer some help I would really appreciate it. Simon.
Вложения
On Wednesday, March 31, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
error: invalid input syntax for type bigint: "blog_user_id"
You should read the “arguments” description under the create trigger syntax. It explains why when you wrote the column name blog_user_id is tried to interpret that as a bigint (since that is the parameter type for the trigger function).
David J.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, April 1st, 2021 at 06:10, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, March 31, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐error: invalid input syntax for type bigint: "blog_user_id"You should read the “arguments” description under the create trigger syntax. It explains why when you wrote the column name blog_user_id is tried to interpret that as a bigint (since that is the parameter type for the trigger function).David J.
Sorry if I am misunderstanding. I'm still pretty new to PostgreSQL but the column actually is a bigint (well technically a bigserial) which is why I am confused.
Simon.
Вложения
On Wednesday, March 31, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐Sorry if I am misunderstanding. I'm still pretty new to PostgreSQL but the column actually is a bigint (well technically a bigserial) which is why I am confused.
‘The arguments are literal string constants.“
A column reference is simply not possible since arguments can only be “literal string constants”.
David J.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, April 1st, 2021 at 06:25, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, March 31, 2021, Simon Connah <simon.n.connah@protonmail.com> wrote:‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐Sorry if I am misunderstanding. I'm still pretty new to PostgreSQL but the column actually is a bigint (well technically a bigserial) which is why I am confused.‘The arguments are literal string constants.“A column reference is simply not possible since arguments can only be “literal string constants”.David J.
Ah, I see. Anyway I managed to fix it with this code:
Thank you for your help!