pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Must re-connect to see tables
6+ messages / 4 participants
[nested] [flat]

* Must re-connect to see tables
@ 2018-03-27 11:22  Blake McBride <blake@mcbride.name>
  0 siblings, 2 replies; 6+ messages in thread

From: Blake McBride @ 2018-03-27 11:22 UTC (permalink / raw)
  To: pgsql-general

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

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Must re-connect to see tables
@ 2018-03-27 11:23  Blake McBride <blake@mcbride.name>
  parent: Blake McBride <blake@mcbride.name>
  1 sibling, 1 reply; 6+ messages in thread

From: Blake McBride @ 2018-03-27 11:23 UTC (permalink / raw)
  To: pgsql-general

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@mcbride.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
>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Must re-connect to see tables
@ 2018-03-27 11:28  Ron <ronljohnsonjr@gmail.com>
  parent: Blake McBride <blake@mcbride.name>
  1 sibling, 0 replies; 6+ messages in thread

From: Ron @ 2018-03-27 11:28 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

If it worked in 9.3.22 and now it's failed in 9.3.22, then  I'd look to see 
if something has changed in data.sql.

On 03/27/2018 06:22 AM, Blake McBride 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
>

-- 
Angular momentum makes the world go 'round.




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Must re-connect to see tables
@ 2018-03-27 11:48  rob stone <floriparob@gmail.com>
  parent: Blake McBride <blake@mcbride.name>
  0 siblings, 1 reply; 6+ messages in thread

From: rob stone @ 2018-03-27 11:48 UTC (permalink / raw)
  To: Blake McBride <blake@mcbride.name>; pgsql-general

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@mcbride.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?

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?

Cheers,
Rob




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Must re-connect to see tables
@ 2018-03-27 12:16  Blake McBride <blake@mcbride.name>
  parent: rob stone <floriparob@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Blake McBride @ 2018-03-27 12:16 UTC (permalink / raw)
  To: rob stone <floriparob@gmail.com>; +Cc: pgsql-general

On Tue, Mar 27, 2018 at 6:48 AM, rob stone <floriparob@gmail.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@mcbride.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
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Must re-connect to see tables
@ 2018-03-27 12:31  Daniel Verite <daniel@manitou-mail.org>
  parent: Blake McBride <blake@mcbride.name>
  0 siblings, 0 replies; 6+ messages in thread

From: Daniel Verite @ 2018-03-27 12:31 UTC (permalink / raw)
  To: Blake McBride <blake@mcbride.name>; +Cc: rob stone <floriparob@gmail.com>; pgsql-general

	Blake McBride wrote:

> 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.

An effect of reconnecting is to reset the search_path to what
it was before including your dump file.
You're most certainly affected by the search_path-related
changes in pg_dump done in the latest versions following
CVE-2018-1058
See https://www.postgresql.org/support/security/
or
https://www.postgresql.org/about/news/1834/

Manually issuing
  RESET search_path;
after \i data.sql should get "public" back in the search_path
without reconnecting and after that \dt would work as usual.


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-03-27 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 11:22 Must re-connect to see tables Blake McBride <blake@mcbride.name>
2018-03-27 11:23 ` Blake McBride <blake@mcbride.name>
2018-03-27 11:48   ` rob stone <floriparob@gmail.com>
2018-03-27 12:16     ` Blake McBride <blake@mcbride.name>
2018-03-27 12:31       ` Daniel Verite <daniel@manitou-mail.org>
2018-03-27 11:28 ` Ron <ronljohnsonjr@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox