Re: BUG #13744: Postgresql function auto add 's' character to the end of string

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: b(dot)phamhuu(at)jacobs-university(dot)de
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13744: Postgresql function auto add 's' character to the end of string
Date: 2015-10-29 22:42:43
Message-ID: CAB7nPqQ1wh0k+M9wkmdUBr9nkyC12T7vvF0PDYVCAozzEqSjfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 29, 2015 at 1:57 PM, <b(dot)phamhuu(at)jacobs-university(dot)de> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13744
> Logged by: Bang
> Email address: b(dot)phamhuu(at)jacobs-university(dot)de
> PostgreSQL version: 9.2.13
> Operating system: Centos 7
> Description:
>
> I've a function in Postgresql database. However, every time I run the
> function in postgresql, it auto add character 's' behind of the query so it
> will be error when execute (for example: WHAT IN HERE: query SELECT uom_id
> FROM ps_quantity where id = 11s ). My version is Postgresql 9.2.13. How can
> I solve this?

You are mistaking the use of '%' and '%s'. When using RAISE NOTICE in
plpgsql you should just use '%' and not '%s' when assigning a variable
in a message. If you are willing to use %s, you can use format():
=# select format('string1: %s, string2: %s', 'titi', 'toto');
format
------------------------------
string1: titi, string2: toto
(1 row)
Regards,
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message dtyshecky 2015-10-29 23:08:46 BUG #13747: Like clause ignoring raws with null value
Previous Message kchinnathambu 2015-10-29 18:28:40 BUG #13746: SQL Query Window stopped working