Thread: Quick fix so \d indexname works again

Quick fix so \d indexname works again

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't think this is worthy of a full patch, but could someone
back off of the new pg_get_expr function in
src/bin/psql/describe.c? It does not seem to work, producing
this message when you try to "\d indexname" in psql:

ERROR:  Function 'pg_get_expr(text, oid)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts


A quick fix is to remove the pg_get_expr function and replace
it with a simple i.indpred. Either that, or get the pg_get_expr
to work properly (which is beyond me at the moment :)


*** ./src/bin/psql/describe.c.orig      Mon Nov  5 15:11:02 2001
- --- ./src/bin/psql/describe.c   Mon Nov  5 15:11:40 2001
***************
*** 654,660 ****
                PGresult   *result;

                sprintf(buf, "SELECT i.indisunique, i.indisprimary, a.amname,\n"
!                               "       pg_get_expr(i.indpred, i.indrelid) as indpred\n"
                                "FROM pg_index i, pg_class c, pg_am a\n"
                                "WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid",
                                name);
- --- 654,660 ----
                PGresult   *result;

                sprintf(buf, "SELECT i.indisunique, i.indisprimary, a.amname,\n"
!                               "       i.indpred\n"
                                "FROM pg_index i, pg_class c, pg_am a\n"
                                "WHERE i.indexrelid = c.oid AND c.relname = '%s' AND c.relam = a.oid",
                                name);






Thanks,
Greg Sabino Mullane
greg@turnstep.com
PGP Key: 0x14964AC8 200111051523

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBO+b2VLybkGcUlkrIEQIdIQCfZxoEJdtbdLVte+WXZeSii+hJweMAoKue
ixzMXJskieqIuLwOWA5ToWzP
=Jkol
-----END PGP SIGNATURE-----


Re: Quick fix so \d indexname works again

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
> I don't think this is worthy of a full patch, but could someone
> back off of the new pg_get_expr function in
> src/bin/psql/describe.c?

No, because it is not broken.

> ERROR:  Function 'pg_get_expr(text, oid)' does not exist

This suggests that you are trying to use a 7.2 psql against a pre-7.2
backend.

            regards, tom lane