Re: How to run a script with Query Tool?

From: Richard Bernstein <richb201(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: How to run a script with Query Tool?
Date: 2020-06-19 20:37:30
Message-ID: CAKXm1c2=a4F8Ms2upFFHGUSts0+FpMCO1Fh3SJQ1ZEQfjNAvaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

OKl. So it is clear that script to create the sample data is for mySQL. And
I want to use it on postgresql. Is there any automated way to convert the
script from mysql ro postgresql? Or do I need to learn enough about
scripting (both for mysql and prostgresql )to manually make that change?

On Fri, Jun 19, 2020 at 12:09 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Richard Bernstein <richb201(at)gmail(dot)com> writes:
> > I have a script that I need to run. The SQL script first creates a
> database
> > called sampledb.
> > CREATE DATABASE `sampledb`
> > I read in the docs that to start the Query Tool I need to pick Query Tool
> > from the Tools menu. But the Query Tool is greyed out unless I have
> already
> > chosen a database. I am concerned about running the script (which
> creates a
> > database) since I am already in a database. Seems illogical. Can someone
> > confirm that I can run my script in any of the existing databases with
> > causing a major issue for myself?
>
> You *must* connect to some existing database in the cluster to issue
> CREATE DATABASE. Doesn't matter which one.
>
> The more interesting question is that your script probably then wishes to
> reconnect to the new database so it can do things there. I'm not sure how
> you'd do that in pgadmin (which I assume is what you're talking about).
> You might want to ask that question on a pgadmin-specific list, which this
> isn't.
>
> regards, tom lane
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Bernstein 2020-06-20 01:45:03 manual for syntax for pg Query Tool
Previous Message Tom Lane 2020-06-19 16:09:49 Re: How to run a script with Query Tool?