Thread: Windows command line utilities problems

Windows command line utilities problems

From
"Paul Buder"
Date:
I am using postgresql 8.0 beta 4 on win2000.

psql operates strangely within a cmd.exe window. It is somewhat like if
you backgrounded the command in unix.  with psql in interactive mode (no
-f switch) whatever line you type is alternately processed by cmd.exe and
psql.


So you get the following (more commentary below the second dotted line)
=======================================================================
C:\Documents and Settings\satbuy.EUG-POS-02>psql -U postgres book

C:\Documents and Settings\satbuy.EUG-POS-02>Welcome to psql 8.0.0beta4,
the Post
greSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

Warning: Console codepage (437) differs from windows codepage (1252)
         8-bit characters will not work correctly. See PostgreSQL
         documentation "Installation on Windows" for details.

book=# dir
 Volume in drive C has no label.
 Volume Serial Number is 41AD-7C61

 Directory of C:\Documents and Settings\satbuy.EUG-POS-02

12/02/2004  12:29p      <DIR>          .
12/02/2004  12:29p      <DIR>          ..
11/30/2004  12:06p      <DIR>          Desktop
12/02/2004  12:29p                   0 dir
11/22/2004  05:02p      <DIR>          Favorites
11/22/2004  04:30p      <DIR>          My Documents
12/02/2004  12:29p                   0 psql
12/02/2004  12:29p                   0 select
07/10/2003  03:39a      <DIR>          Start Menu
12/02/2004  12:29p                   0 Welcome
               4 File(s)              0 bytes
               6 Dir(s)  33,284,308,992 bytes free

C:\Documents and Settings\satbuy.EUG-POS-02>select * from mbs limit 1;
 matkey  | matseq | mbsno | mmbsck |     author     |    authori     |
title
      |    titlei    | edition | binding | publisher | publisheri | imprint |
isbn    | price | mbillf | mreflg | mrfbkx | mrelfl | mactx | mntxfl |
mbs_comme
nt | mtguid | status | mtxtrd | mtlmt | unique_id
---------+--------+-------+--------+----------------+----------------+----------
------+--------------+---------+---------+-----------+------------+---------+---
--------+-------+--------+--------+--------+--------+-------+--------+----------
---+--------+--------+--------+-------+-----------
 ||||||| |      1 |     1 |      0 | CLEAN WITH ALL | clean with all |
PAGES IN
TACT! | pages intact |         |         |           |            |
 | 00
0000000 |     0 |        |        |      0 |        |     0 |        |
   |      0 |        |      0 |   999 |         1
(1 row)

book=# select * from mbs limit 1;
'select' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\satbuy.EUG-POS-02>dir;
ERROR:  syntax error at or near "dir" at character 1
LINE 1: dir;
        ^
book=#
C:\Documents and Settings\satbuy.EUG-POS-02>

=======================================================================



If you run psql with the -f switch you get the windows command prompt back
immediately. The command continues running echo the usual stuff to screen
such as SELECT or CREATE INDEX. This is confusing because it is hard to
tell when postgres as finished processing the file.

SELECT, CREATE INDEX and the rest show on the screen.  However, COPY is
not displaying.

The -f switch doesn't seem to handle relative paths correctly. If my
current directory is the desktop, and I have a file mbs.dump on my desktop
and I type
psql -U postgres -f mbs.dump book
it says the system can't find the specified file.

Without relative paths but using < I get no error message and no results with
psql -U postgres book < c:\mbs.dump

Overall the server on windows seems to work pretty well but psql seems a
bit messy right now.