Thread: Re: your mail

Re: your mail

From
Bruce Momjian
Date:
>   By the way, I have a sugestion I'd like to do about psql:
>
>   It would be a good idea, IMHO, that if psql is called alone (without
> database nor any parameter), instead of try to connect to database 'user'
> starts interactively without connection.  Then, simple calling "\c dbname"
> would connect the user to the desired database.  What you think?
>   Cheers,

This seems like a good idea.  Any comments?

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Re: your mail

From
Brett McCormick
Date:
I dunno, I think it's kind of nice the way is really.  Perhaps if the
user db doesn't exist, it could say so and start interactively as per
below.  Either way I'm not sure it matters though.  I think it just
nice for connecting to my random test databases.

On Sat, 7 March 1998, at 11:11:42, Bruce Momjian wrote:

> >   By the way, I have a sugestion I'd like to do about psql:
> >
> >   It would be a good idea, IMHO, that if psql is called alone (without
> > database nor any parameter), instead of try to connect to database 'user'
> > starts interactively without connection.  Then, simple calling "\c dbname"
> > would connect the user to the desired database.  What you think?
> >   Cheers,
>
> This seems like a good idea.  Any comments?
>
> --
> Bruce Momjian                          |  830 Blythe Avenue
> maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
>   +  If your life is a hard drive,     |  (610) 353-9879(w)
>   +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Re: your mail

From
"Roland B. Roberts"
Date:
>>>>> "bm" == Bruce Momjian <maillist@candle.pha.pa.us> writes:

    >> By the way, I have a sugestion I'd like to do about psql:
    >>
    >> It would be a good idea, IMHO, that if psql is called alone
    >> (without database nor any parameter), instead of try to connect
    >> to database 'user' starts interactively without connection.
    >> Then, simple calling "\c dbname" would connect the user to the
    >> desired database.  What you think?  Cheers,

    bm> This seems like a good idea.  Any comments?

I don't mind the current setup, but would like it to not dump me out
if I don't have a database named `roland'.  I tend to give my
databases a name that pertains to what they contain, not who uses
them.

Still, having it attempt to connect to `roland' and then leave me at
the psql prompt with a message like "You are not connected to any
database" would be more friendly....

roland
--
Roland B. Roberts, PhD                  Custom Software Solutions
roberts@panix.com                           101 West 15th St #4NN
                                               New York, NY 10011

Re: [HACKERS] Re: your mail

From
"Thomas G. Lockhart"
Date:
> >   It would be a good idea, IMHO, that if psql is called alone (without
> > database nor any parameter), instead of try to connect to database 'user'
> > starts interactively without connection.  Then, simple calling "\c dbname"
> > would connect the user to the desired database.  What you think?
> >   Cheers,
>
> This seems like a good idea.  Any comments?

Of course :) I personally like the current default behavior, and I think that
some others find it similarly convenient. If the alternate behavior is
desirable for some, how about implementing a command line switch which would
change the default behavior to "don't open anything". Then, you can alias the
definition of psql to get what you want.

I actually had a patch of some sort which changed the behavior of "\c
unknownDB"; at the moment if a connection fails psql bails out. The patch left
the psql session open and connected to the previous database. That behavior
would be dangerous in some cases so we didn't apply it; going to an
"unconnected state" would be more helpful and less dangerous.

                                                     - Tom