~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/bin/psql/command.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Copyright (c) 2000-2009, PostgreSQL Global Development Group
5
5
 *
6
 
 * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.205 2009/04/21 15:49:06 momjian Exp $
 
6
 * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.206 2009/06/11 14:49:07 momjian Exp $
7
7
 */
8
8
#include "postgres_fe.h"
9
9
#include "command.h"
57
57
                         PsqlScanState scan_state,
58
58
                         PQExpBuffer query_buf);
59
59
static bool do_edit(const char *filename_arg, PQExpBuffer query_buf,
60
 
                                        bool *edited);
 
60
                bool *edited);
61
61
static bool do_connect(char *dbname, char *user, char *host, char *port);
62
62
static bool do_shell(const char *command);
63
63
static bool lookup_function_oid(PGconn *conn, const char *desc, Oid *foid);
327
327
        else if (cmd[0] == 'd')
328
328
        {
329
329
                char       *pattern;
330
 
                bool            show_verbose, show_system;
 
330
                bool            show_verbose,
 
331
                                        show_system;
331
332
 
332
333
                /* We don't do SQLID reduction on the pattern yet */
333
334
                pattern = psql_scan_slash_option(scan_state,
375
376
                                        case 'n':
376
377
                                        case 't':
377
378
                                        case 'w':
378
 
                                                success =  describeFunctions(&cmd[2], pattern, show_verbose, show_system);
 
379
                                                success = describeFunctions(&cmd[2], pattern, show_verbose, show_system);
379
380
                                                break;
380
381
                                        default:
381
382
                                                status = PSQL_CMD_UNKNOWN;
432
433
                                }
433
434
                                break;
434
435
                        case 'e':                       /* SQL/MED subsystem */
435
 
                                switch(cmd[2])
 
436
                                switch (cmd[2])
436
437
                                {
437
438
                                        case 's':
438
439
                                                success = listForeignServers(pattern, show_verbose);
530
531
 
531
532
                if (status != PSQL_CMD_ERROR)
532
533
                {
533
 
                        bool edited = false;
 
534
                        bool            edited = false;
534
535
 
535
536
                        if (!do_edit(0, query_buf, &edited))
536
537
                                status = PSQL_CMD_ERROR;
989
990
        else if (strcmp(cmd, "timing") == 0)
990
991
        {
991
992
                char       *opt = psql_scan_slash_option(scan_state,
992
 
                                                                                             OT_NORMAL, NULL, false);
 
993
                                                                                                 OT_NORMAL, NULL, false);
 
994
 
993
995
                if (opt)
994
996
                        pset.timing = ParseVariableBool(opt);
995
997
                else
1292
1294
        PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
1293
1295
        pset.db = n_conn;
1294
1296
        SyncVariables();
1295
 
        connection_warnings(); /* Must be after SyncVariables */
 
1297
        connection_warnings();          /* Must be after SyncVariables */
1296
1298
 
1297
1299
        /* Tell the user about the new connection */
1298
1300
        if (!pset.quiet)
1341
1343
                                server_version = server_ver_str;
1342
1344
                        }
1343
1345
 
1344
 
                        printf(_("%s (%s, server %s)\n"), 
1345
 
                        pset.progname, PG_VERSION, server_version);
 
1346
                        printf(_("%s (%s, server %s)\n"),
 
1347
                                   pset.progname, PG_VERSION, server_version);
1346
1348
                }
1347
1349
                else
1348
1350
                        printf("%s (%s)\n", pset.progname, PG_VERSION);
1349
1351
 
1350
1352
                if (pset.sversion / 100 != client_ver / 100)
1351
1353
                        printf(_("WARNING: %s version %d.%d, server version %d.%d.\n"
1352
 
                                 "         Some psql features might not work.\n"),
1353
 
                                pset.progname, client_ver / 10000, (client_ver / 100) % 100,
1354
 
                                pset.sversion / 10000, (pset.sversion / 100) % 100);
 
1354
                                         "         Some psql features might not work.\n"),
 
1355
                                 pset.progname, client_ver / 10000, (client_ver / 100) % 100,
 
1356
                                   pset.sversion / 10000, (pset.sversion / 100) % 100);
1355
1357
 
1356
1358
#ifdef WIN32
1357
1359
                checkWin32Codepage();
1381
1383
        printf(_("SSL connection (cipher: %s, bits: %i)\n"),
1382
1384
                   SSL_get_cipher(ssl), sslbits);
1383
1385
#else
 
1386
 
1384
1387
        /*
1385
 
         * If psql is compiled without SSL but is using a libpq with SSL,
1386
 
         * we cannot figure out the specifics about the connection. But
1387
 
         * we know it's SSL secured.
 
1388
         * If psql is compiled without SSL but is using a libpq with SSL, we
 
1389
         * cannot figure out the specifics about the connection. But we know it's
 
1390
         * SSL secured.
1388
1391
         */
1389
1392
        if (PQgetssl(pset.db))
1390
1393
                printf(_("SSL connection (unknown cipher)\n"));
1410
1413
        {
1411
1414
                printf(_("WARNING: Console code page (%u) differs from Windows code page (%u)\n"
1412
1415
                                 "         8-bit characters might not work correctly. See psql reference\n"
1413
 
                             "         page \"Notes for Windows users\" for details.\n"),
 
1416
                                 "         page \"Notes for Windows users\" for details.\n"),
1414
1417
                           concp, wincp);
1415
1418
        }
1416
1419
}
2028
2031
{
2029
2032
        bool            result = true;
2030
2033
        PQExpBuffer query;
2031
 
        PGresult *res;
 
2034
        PGresult   *res;
2032
2035
 
2033
2036
        query = createPQExpBuffer();
2034
2037
        printfPQExpBuffer(query, "SELECT ");
2060
2063
{
2061
2064
        bool            result = true;
2062
2065
        PQExpBuffer query;
2063
 
        PGresult *res;
 
2066
        PGresult   *res;
2064
2067
 
2065
2068
        query = createPQExpBuffer();
2066
2069
        printfPQExpBuffer(query, "SELECT pg_catalog.pg_get_functiondef(%u)", oid);