Re: Must re-connect to see tables

From: Blake McBride <blake(at)mcbride(dot)name>
To: rob stone <floriparob(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Must re-connect to see tables
Date: 2018-03-27 12:16:01
Message-ID: CABwHSOv5mCK1mz-jtpQW9txqYAzC2cph=SUpJSfYc7VnmmjQ+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 27, 2018 at 6:48 AM, rob stone <floriparob(at)gmail(dot)com> wrote:

> Hello Blake,
>
> On Tue, 2018-03-27 at 06:23 -0500, Blake McBride wrote:
> > I should also mention that I am using PostgreSQL 9.3.22 on a 64 bit
> > Linux box.
> >
> > On Tue, Mar 27, 2018 at 6:22 AM, Blake McBride <blake(at)mcbride(dot)name>
> > wrote:
> > > Hi,
> > >
> > > I have been using PostgreSQL for many years but all of a sudden a
> > > db load script I've been using no longer works. What id does
> > > (essentially) is:
> > >
> > > psql postgres postgres
> > > drop database test;
> > > create database test;
> > > \c test
> > > \i data.sql
> > > \dt
> > > \q
> > >
> > >
> > > I tested this with a small data.sql and it worked fine. However,
> > > when I use a real (much larger) data.sql then \dt replies "No
> > > relations" ! I found this if I stick an extra '\c test' after the
> > > '\i data.sql' it works.
> > >
> > > The data.sql is a PostgreSQL dump from another database. When the
> > > '\i data.sql' is done, the prompt still shows 'test#' so it's not
> > > like I've changed databases.
> > >
> > > I only have one schema, 'public'.
> > >
> > > Can't figure out why a simple example works but a large file
> > > requires an extra \c.
> > >
> > > Sure appreciate any help.
> > >
> > > Blake McBride
> > >
> >
> >
>
>
>
>
> 1) Where does your e-mail subject line "Must re-connect to see tables"
> relate to the import?
>

I do the import and then \dt return no relations. I must *re-connect* via
\c in order to see the tables. (According to the prompt, I was still
connected to the database.)

>
> 2) Does the larger data.sql file have a "create database" line or any
> other construct at the beginning of the file that would cause it to NOT
> insert rows into database test?
>

data.sql is an untouched dump of a database from PostgreSQL 9.5.12.

The import seems to have worked. I just need another \c after the \i.

Thanks!

Blake

>
> Cheers,
> Rob
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2018-03-27 12:31:32 Re: Must re-connect to see tables
Previous Message rob stone 2018-03-27 11:48:02 Re: Must re-connect to see tables