pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18231: String conversion function is adding special characters in Postgres 15
2+ messages / 2 participants
[nested] [flat]
* BUG #18231: String conversion function is adding special characters in Postgres 15
@ 2023-12-07 09:16 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2023-12-07 09:16 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: work.anvesh@gmail.com
The following bug has been logged on the website:
Bug reference: 18231
Logged by: anvesh work
Email address: work.anvesh@gmail.com
PostgreSQL version: 15.0
Operating system: Windows 10
Description:
I have a function which was working fine in Postgres 10 but not in Postgres
15.
When I traced the program, I am facing issue with the VARDATA(arg2).
The arg2 is 2nd argument used in the calling function from PGAdmin4.
After conversion it is returning text with special characters.
In Postgres 10, note that 4 characters are concatenated with special
characters, but other characters are working fine.
Following are the lines of code:
pgsql:
select functionname('arg1', 'arg2', 'arg3');
My Method in C program has
text *arg2 = PG_GETARG_TEXT_P(1);
int output = PbValue (VARDATA(arg2));
Postgres.h file:
#define VARDATA(PTR) VARDATA_4B(PTR)
#define VARDATA_4B(PTR) (((varattrib_4b *) (PTR))->va_4byte.va_data)
To resolve this, we have used memcpy for converting characters.
memcpy(str, VARDATA(arg2), arg_size);
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18231: String conversion function is adding special characters in Postgres 15
@ 2023-12-07 10:51 Heikki Linnakangas <hlinnaka@iki.fi>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Linnakangas @ 2023-12-07 10:51 UTC (permalink / raw)
To: work.anvesh@gmail.com; pgsql-bugs@lists.postgresql.org
On 07/12/2023 11:16, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 18231
> Logged by: anvesh work
> Email address: work.anvesh@gmail.com
> PostgreSQL version: 15.0
> Operating system: Windows 10
> Description:
>
> I have a function which was working fine in Postgres 10 but not in Postgres
> 15.
>
> When I traced the program, I am facing issue with the VARDATA(arg2).
> The arg2 is 2nd argument used in the calling function from PGAdmin4.
> After conversion it is returning text with special characters.
> In Postgres 10, note that 4 characters are concatenated with special
> characters, but other characters are working fine.
> Following are the lines of code:
> pgsql:
> select functionname('arg1', 'arg2', 'arg3');
>
> My Method in C program has
> text *arg2 = PG_GETARG_TEXT_P(1);
> int output = PbValue (VARDATA(arg2));
>
> Postgres.h file:
> #define VARDATA(PTR) VARDATA_4B(PTR)
> #define VARDATA_4B(PTR) (((varattrib_4b *) (PTR))->va_4byte.va_data)
>
>
> To resolve this, we have used memcpy for converting characters.
> memcpy(str, VARDATA(arg2), arg_size);
I bet the problem is in your C function, but there's not enough details
here to say where exactly. I don't understand what you mean string
conversion or special characters, for starters.
If provide a short self-contained 10-20 lines example that demonstrates
the problem, and send it as a reply to this list, someone might be able
to point out what the problem is.
--
Heikki Linnakangas
Neon (https://neon.tech)
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-12-07 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07 09:16 BUG #18231: String conversion function is adding special characters in Postgres 15 PG Bug reporting form <noreply@postgresql.org>
2023-12-07 10:51 ` Heikki Linnakangas <hlinnaka@iki.fi>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox