From a5d07db739991208d27eb5bf373388cd01c4c762 Mon Sep 17 00:00:00 2001 From: Shigeru Hanada Date: Thu, 28 Oct 2010 17:22:36 +0900 Subject: [PATCH] Fix indent and trailing space. --- contrib/postgresql_fdw/Makefile | 4 +- src/bin/psql/describe.c | 182 ++++++++++++++++---------------- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/contrib/postgresql_fdw/Makefile b/contrib/postgresql_fdw/Makefile index 2dd917be38..c55b58dbc2 100644 --- a/contrib/postgresql_fdw/Makefile +++ b/contrib/postgresql_fdw/Makefile @@ -5,8 +5,8 @@ PG_CPPFLAGS = -I$(libpq_srcdir) OBJS = postgresql_fdw.o fsconnection.o SHLIB_LINK = $(libpq) -DATA_built = postgresql_fdw.sql -DATA = uninstall_postgresql_fdw.sql +DATA_built = postgresql_fdw.sql +DATA = uninstall_postgresql_fdw.sql REGRESS = postgresql_fdw diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 4e90d1dc93..90c3aacbf3 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -1858,119 +1858,119 @@ describeOneTableDetails(const char *schemaname, */ if (tableinfo.hastriggers) { - PGresult *result; - int tuples; + PGresult *result; + int tuples; - printfPQExpBuffer(&buf, - "SELECT t.tgname, " - "pg_catalog.pg_get_triggerdef(t.oid%s), " - "t.tgenabled\n" - "FROM pg_catalog.pg_trigger t\n" - "WHERE t.tgrelid = '%s' AND ", - (pset.sversion >= 90000 ? ", true" : ""), - oid); - if (pset.sversion >= 90000) - appendPQExpBuffer(&buf, "NOT t.tgisinternal"); - else if (pset.sversion >= 80300) - appendPQExpBuffer(&buf, "t.tgconstraint = 0"); - else - appendPQExpBuffer(&buf, - "(NOT tgisconstraint " - " OR NOT EXISTS" - " (SELECT 1 FROM pg_catalog.pg_depend d " - " JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) " - " WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))"); - appendPQExpBuffer(&buf, "\nORDER BY 1"); + printfPQExpBuffer(&buf, + "SELECT t.tgname, " + "pg_catalog.pg_get_triggerdef(t.oid%s), " + "t.tgenabled\n" + "FROM pg_catalog.pg_trigger t\n" + "WHERE t.tgrelid = '%s' AND ", + (pset.sversion >= 90000 ? ", true" : ""), + oid); + if (pset.sversion >= 90000) + appendPQExpBuffer(&buf, "NOT t.tgisinternal"); + else if (pset.sversion >= 80300) + appendPQExpBuffer(&buf, "t.tgconstraint = 0"); + else + appendPQExpBuffer(&buf, + "(NOT tgisconstraint " + " OR NOT EXISTS" + " (SELECT 1 FROM pg_catalog.pg_depend d " + " JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) " + " WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))"); + appendPQExpBuffer(&buf, "\nORDER BY 1"); - result = PSQLexec(buf.data, false); - if (!result) - goto error_return; - else - tuples = PQntuples(result); + result = PSQLexec(buf.data, false); + if (!result) + goto error_return; + else + tuples = PQntuples(result); - if (tuples > 0) - { - bool have_heading; - int category; - - /* - * split the output into 4 different categories. Enabled - * triggers, disabled triggers and the two special ALWAYS and - * REPLICA configurations. - */ - for (category = 0; category < 4; category++) + if (tuples > 0) { - have_heading = false; - for (i = 0; i < tuples; i++) - { - bool list_trigger; - const char *tgdef; - const char *usingpos; - const char *tgenabled; - - /* - * Check if this trigger falls into the current - * category - */ - tgenabled = PQgetvalue(result, i, 2); - list_trigger = false; - switch (category) - { - case 0: - if (*tgenabled == 'O' || *tgenabled == 't') - list_trigger = true; - break; - case 1: - if (*tgenabled == 'D' || *tgenabled == 'f') - list_trigger = true; - break; - case 2: - if (*tgenabled == 'A') - list_trigger = true; - break; - case 3: - if (*tgenabled == 'R') - list_trigger = true; - break; - } - if (list_trigger == false) - continue; + bool have_heading; + int category; - /* Print the category heading once */ - if (have_heading == false) + /* + * split the output into 4 different categories. Enabled + * triggers, disabled triggers and the two special ALWAYS and + * REPLICA configurations. + */ + for (category = 0; category < 4; category++) + { + have_heading = false; + for (i = 0; i < tuples; i++) { + bool list_trigger; + const char *tgdef; + const char *usingpos; + const char *tgenabled; + + /* + * Check if this trigger falls into the current + * category + */ + tgenabled = PQgetvalue(result, i, 2); + list_trigger = false; switch (category) { case 0: - printfPQExpBuffer(&buf, _("Triggers:")); + if (*tgenabled == 'O' || *tgenabled == 't') + list_trigger = true; break; case 1: - printfPQExpBuffer(&buf, _("Disabled triggers:")); + if (*tgenabled == 'D' || *tgenabled == 'f') + list_trigger = true; break; case 2: - printfPQExpBuffer(&buf, _("Triggers firing always:")); + if (*tgenabled == 'A') + list_trigger = true; break; case 3: - printfPQExpBuffer(&buf, _("Triggers firing on replica only:")); + if (*tgenabled == 'R') + list_trigger = true; break; + } + if (list_trigger == false) + continue; + + /* Print the category heading once */ + if (have_heading == false) + { + switch (category) + { + case 0: + printfPQExpBuffer(&buf, _("Triggers:")); + break; + case 1: + printfPQExpBuffer(&buf, _("Disabled triggers:")); + break; + case 2: + printfPQExpBuffer(&buf, _("Triggers firing always:")); + break; + case 3: + printfPQExpBuffer(&buf, _("Triggers firing on replica only:")); + break; + } + printTableAddFooter(&cont, buf.data); + have_heading = true; } - printTableAddFooter(&cont, buf.data); - have_heading = true; - } - /* Everything after "TRIGGER" is echoed verbatim */ - tgdef = PQgetvalue(result, i, 1); - usingpos = strstr(tgdef, " TRIGGER "); - if (usingpos) - tgdef = usingpos + 9; + /* Everything after "TRIGGER" is echoed verbatim */ + tgdef = PQgetvalue(result, i, 1); + usingpos = strstr(tgdef, " TRIGGER "); + if (usingpos) + tgdef = usingpos + 9; - printfPQExpBuffer(&buf, " %s", tgdef); - printTableAddFooter(&cont, buf.data); + printfPQExpBuffer(&buf, " %s", tgdef); + printTableAddFooter(&cont, buf.data); + } } } - } - PQclear(result); + PQclear(result); } /* -- 2.39.5