public inbox for [email protected]
help / color / mirror / Atom feedRe: POprepare fails
3+ messages / 2 participants
[nested] [flat]
* Re: POprepare fails
@ 2026-03-12 20:04 Laurenz Albe <[email protected]>
parent: Igor Korot <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Laurenz Albe @ 2026-03-12 20:04 UTC (permalink / raw)
To: Igor Korot <[email protected]>; pgsql-generallists.postgresql.org <[email protected]>
On Thu, 2026-03-12 at 20:16 -0500, Igor Korot wrote:
> ERROR: syntax error at or near \"AND\"\n
> LINE 1: ...lnamespace AND idx.indisprimary AND n.nspname = ? AND t.reln...
>
> What is going on?
You used the question mark as a parameter placeholder, but you are using
the C API, not JDBC. The placeholders are $1, $2 and so on.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: POprepare fails
@ 2026-03-12 20:16 Igor Korot <[email protected]>
parent: Laurenz Albe <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Igor Korot @ 2026-03-12 20:16 UTC (permalink / raw)
To: Laurenz Albe <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>
Thx, Lauren’s.
On Thu, Mar 12, 2026 at 1:04 PM Laurenz Albe <[email protected]>
wrote:
> On Thu, 2026-03-12 at 20:16 -0500, Igor Korot wrote:
> > ERROR: syntax error at or near \"AND\"\n
> > LINE 1: ...lnamespace AND idx.indisprimary AND n.nspname = ? AND
> t.reln...
> >
> > What is going on?
>
> You used the question mark as a parameter placeholder, but you are using
> the C API, not JDBC. The placeholders are $1, $2 and so on.
>
> Yours,
> Laurenz Albe
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* POprepare fails
@ 2026-03-13 01:16 Igor Korot <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Igor Korot @ 2026-03-13 01:16 UTC (permalink / raw)
To: pgsql-generallists.postgresql.org <[email protected]>
Hi, ALL,
646 if( !result )
(gdb)
648 res1 = PQprepare( m_db, "get_pk_prop",
m_pimpl->m_myconv.to_bytes( query8 ).c_str(), 3, nullptr );
(gdb)
649 auto status = PQresultStatus( res1 );
(gdb)
650 if( status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK )
(gdb)
652 std::wstring err = m_pimpl->m_myconv.from_bytes(
PQerrorMessage( m_db ) );
(gdb) p query8
$1 = L"SELECT c.relname AS name, ixs.tablespace AS tbspace, am.amname
AS type, ARRAY(SELECT a.attname FROM pg_attribute a WHERE a.attrelid =
idx.indrelid AND a.attnum
= ANY(idx.indkey) AND a.attnum > 0 ORDER"...
(gdb) n
653 errorMsg.push_back( err );
(gdb) p err
$2 = L"ERROR: syntax error at or near \"AND\"\nLINE 1: ...lnamespace
AND idx.indisprimary AND n.nspname = ? AND t.reln...\n", ' ' <repeats
61 times>, "^\n"
draft=# SELECT c.relname AS name, ixs.tablespace AS tbspace, am.amname
AS type, ARRAY(SELECT a.attname FROM pg_attribute a WHERE a.attrelid =
idx.indrelid AND a.attnum
= ANY(idx.indkey) AND a.attnum > 0 ORDER BY array_position(idx.indkey,
a.attnum) OFFSET idx.indnkeyatts) AS included, c.reloptions AS storage
FROM pg_am am, pg_index
idx, pg_class c, pg_namespace n, pg_class t, pg_indexes ixs WHERE
am.oid = c.relam AND ixs.indexname = c.relname AND c.oid =
idx.indexrelid AND t.oid = idx.indrelid AN
D n.oid = c.relnamespace AND idx.indisprimary AND n.nspname = 'public'
AND t.relname = 'leagues_new';
name | tbspace | type | included |
storage
------------------+---------+-------+-------------------------+---------------------------------------
leagues_new_pkey | | btree | {drafttype,scoringtype} |
{fillfactor=50,deduplicate_items=off}
(1 row)
draft=#
What is going on?
Thank you.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-03-13 01:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-13 01:16 POprepare fails Igor Korot <[email protected]>
2026-03-12 20:04 ` Laurenz Albe <[email protected]>
2026-03-12 20:16 ` Igor Korot <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox