POprepare fails

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: POprepare fails
Date: 2026-03-12 19:53:04
Message-ID: CA+FnnTyFmj-dTMDO108_WowHMS479-OFBT71oNC=NY98Vg01Nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2026-03-12 20:04:24 Re: POprepare fails
Previous Message pierre.forstmann 2026-03-11 15:53:52 Re: LISTAGG à la Oracle in PostgreSQL