Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vywyq-000Z5t-1U for pgsql-odbc@arkaria.postgresql.org; Sat, 07 Mar 2026 19:06:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vywyo-009CpS-1V for pgsql-odbc@arkaria.postgresql.org; Sat, 07 Mar 2026 19:06:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vywyo-009CpJ-0s for pgsql-odbc@lists.postgresql.org; Sat, 07 Mar 2026 19:06:26 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vywym-00000001NoM-117B for pgsql-odbc@postgresql.org; Sat, 07 Mar 2026 19:06:26 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-798374d0f44so149892937b3.0 for ; Sat, 07 Mar 2026 11:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772910381; cv=none; d=google.com; s=arc-20240605; b=LM1GGgacNqg9zj/8S1wkAkl9AbhjSltS9x/QF920P6VRtqQYuAs5WmCN9PtAGj+PeG dn2YsuIEQWvnrTxDqSWK9++9kv3DLlEwxAz53CUvLX626yGr1e2O/69a8N7GsDYKA5wV XvlgediOkn11pBGAOSdRxjR96FnagrGua7WCr2fHHGvVIhVZeA6sEfmugZc6u1kqPZuu uniRrrJkX4qMYtNIhcr+Gz1a9g5xTacr2a3xwgy2UZWEnFvPj/9cHj7TmaQ7ST45NHj9 MfWBmLOPNeF1ITXlLrWcZdmwHJ1uf/fkUUs+czj6PkAhjgmA88gBJcNgN8mi2xrfej+a G9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0SuWmBJiAPLuk1id4Vt/xZhXFPRpB1WFjUGrFiGYJ0s=; fh=25X4gWOMe56pFp0sYe0brxxA7ZQQDzwf5jpX83cSVK8=; b=NgzTn1awkyUlCK3N8o5lK2H1viyrmd6z4zAaOGy3F0Xpwz4pd2TQ6wFuYzBkGtPFJJ UC869dF6LB+CvyJrrNUQMAfPcTgf7xRIZowAF1L1XGATUYrlzdPOoQ1JqGAitq04N8su NO7GYy+TnbX8+9+14vGczcrDL/95/eKZGeRJdl0/al1BzXPrLoL+3q77mF4WMnMIYKqV PkD8zQFLRGP+fjJJ3Ui9K2gZl240cmh3KYgVnBw3UP9Xnga4qDBnD7mofHEfqgqcF1QR +6+UzgaUIlzTF1m6LKV/01C81LjJAAhkdSONNEh9kRGYHXNdvw7LyeW1cGhlGUFXRyDr anaA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772910381; x=1773515181; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0SuWmBJiAPLuk1id4Vt/xZhXFPRpB1WFjUGrFiGYJ0s=; b=Avui9NmYXwxVfn3+6l5fvnSskB04EE4wbcZyAYMcaThTV+XOmCynHu2eNeTTmmB/G9 GKGOLwegfLbTqhTQK/1IVqeJQJhqRjMSsNqQ4aidXoTpFkuEQ72qJ+p9R2FFofNALaLI IQ/A5SRQ0VVdiQx63a+Y9v6Xb6mZM84+RVz6EQjWMnu9C7C4zOzGMu1szmx4sCgBUJXc gyMX40VNLIH4JHt21gTjTmq3FoeE7zI0cExwA6h1XGi9ljz4fhZtTKQZ84+7lpSb6lRq +W5Fcz8pTai9Bhb2KkE6BYMu4f5+pfhSi3QK6oxhSZG+hLqaVvP2wwKseOZqza7aBW6H UU4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772910381; x=1773515181; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0SuWmBJiAPLuk1id4Vt/xZhXFPRpB1WFjUGrFiGYJ0s=; b=cKG9W+P78s8vN0sC5wAPXk3iTjJgCIBMXcNW0/e6EVfNrjZh78XbGBBrVAn4ifulLV TtaECDvCZ/sYXTR0nPApbzJ+JlrTpA801rILkyrhyfg7UXVzp0aJ8H4NledF7a74Deu1 biviYKdnObgcvR1FaeaLqZpb9lHJkVXCrwuzKPWDF1dclKw0uklQgbMa6z5/XogTQzaA 89SzD/8osfEJ+cypBr+zVN7R6o0SLvr9I9918GCqnJaVBBWL/N1DfS6XjuhDOJF0N9z1 x6CEz/Kj7ceHG+IvqeaHsl7vUruW+2DnAIf8m1qrex2R0kNYrQBR29NIc8qw3FiCuEAO YC7A== X-Gm-Message-State: AOJu0YxSkPsaLcZ0Iem2wFtyVZk7hQRicpa0GlMl4ninQL2tbyFA7bnD 1iP0pxBRhFHiE02oNEYelRNPM6t6kRULLiVq6ZY4El2SmNgl3xEQLVmbai8G2etIFaDI7vdyGBH TKxJFvUVtFk21fs0gBuSiUPyaF480hGWJXg== X-Gm-Gg: ATEYQzze5Q8rz50O1h9ZZxxoyL1Vw7BTdIjBwmvkrLW8oFZAF8LOgmj9WjD5fOHkv87 GeDJGlubqL9pJAieb6mJFdfPGuH1jhXVU0fwFKQUfFQqoo5GIaJxsFu4RHQe4kUJytQYwnlieUb Fg/wj2KhPxth8SZ91eM4BXKK3WLbWxVYAGJWqkdEjOYz2UUMjKOLDRaazTa1GFdJ0Uw4yItFM54 u3znhz6FeEOJpOXNzucItBEZH8o0QguhRGki0GVwu5nymURNLP+QUUtY1SF4ka9H/1TsbcWEsWG pbWfyUnXaz6Frw== X-Received: by 2002:a05:690c:e3c9:b0:794:ebee:7f15 with SMTP id 00721157ae682-798dd77fc8amr55503447b3.21.1772910381117; Sat, 07 Mar 2026 11:06:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Igor Korot Date: Sat, 7 Mar 2026 13:06:07 -0600 X-Gm-Features: AaiRm52K7P6prTqgGW0CzGnq8MaH6ExfJDvU9Re3CravhsjFbCfmg-gxxukQAGg Message-ID: Subject: Re: How to properly perform this? To: Dave Cramer Cc: PostgreSQL ODBC list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Dave, I think its just an empty column. Is there a way to treat it as NULL? P.S.: Sorry for top-posting. On Sat, Mar 7, 2026 at 5:41=E2=80=AFAM Dave Cramer wrote: > > > Dave Cramer > www.postgres.rocks > > > On Sat, 7 Mar 2026 at 01:10, Igor Korot wrote: >> >> Hi, ALL, >> I'm trying to execute following query: >> >> draft=3D# SELECT c.relname AS name, ixs.tablespace, ARRAY(SELECT >> a.attname FROM pg_attribute a WHERE a.attrelid =3D idx.indrelid AND >> a.attnum =3D 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_index idx, pg_class c, >> pg_namespace n, pg_class t, pg_indexes ixs WHERE ixs.indexname =3D >> c.relname AND c.oid =3D idx.indexrelid AND t.oid =3D idx.indrelid AND >> n.oid =3D c.relnamespace AND idx.indisprimary AND n.nspname =3D 'public' >> AND t.relname =3D 'leagues'; >> name | tablespace | included | storage >> --------------+------------+----------+--------- >> leagues_pkey | | {} | >> (1 row) >> >> >> My code is as follows: >> >> while( ( ret =3D SQLGetData( m_hstmt, 4, SQL_C_WCHAR, >> index_param.get(), 255, &ind[3] ) ) !=3D SQL_NO_DATA ) >> { >> if( ret =3D=3D SQL_SUCCESS || ret =3D=3D SQL_SUCCESS_WIT= H_INFO ) >> { >> auto numBytes =3D ind[3]; >> if( ind[3] =3D=3D SQL_NO_TOTAL ) >> numBytes =3D 255; >> else if( ind[3] > 255 ) >> numBytes =3D 255; >> str_to_uc_cpy( options, index_param.get() ); >> } >> else >> { >> GetErrorMessage( errorMsg, STMT_ERROR ); >> result =3D 1; >> } >> } >> Unfortunately it goes into the loop because apparently the driver or >> the server keeps seeing the last column as having data and returns >> SQL_SUCCESS. >> >> What is the proper way to resolve this? >> >> I'm using unixODBC with PostgreSQL 16. >> >> My odbc.ini looks like this: >> >> [code] >> [postgres] >> Driver=3DPostgres >> Description=3DPostgres ODBC Driver >> UserId=3Dpostgres >> Password=3DXXX >> Servername=3Dlocalhost >> Database=3Ddraft >> Port=3D5432 >> >> [/code] >> >> >> What is the best way to proceed? > > > is the last column empty or null? > > if not null then there is data there. > > Dave