#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    36
    Rep Power
    12

    Question sort of SQL Mode


    I have done sql queries in Oracle & MySQL, they allowed me to type sql commands in lines with the "entern" key.

    I started PostgreSQL a week ago and its command line is different. I don't like to type sql commands in one line. How do you make lines in postgresql?

    Example in PostgreSQL, which I had to do is like this

    CREATE TABLE mytable (tableid UNIQUE .... ); It continues in one line.

    But in Oracle & MySQL, I can do this

    CREATE TABLE myTable {
    tableid,
    tablename,
    };

    This can be done in lines. I hope you understand what I mean. Can PostgreSQL allow something like that?
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    I don't know what you are using to access PostgreSQL, but the standard 'psql' terminal works the same as any other standard SQL system: line breaks are ignored, unless there is a ";" at the end. Also, any GUI tool that I have used to connect to PostgreSQL allows this same behavior.

    Exactly what are you using to access PostgreSQL, and what operating system are you using? Please give examples of your syntax and the results.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    373
    Rep Power
    12
    hello,

    you can use the \i option from the plsql command prompt to run something from a file. I usually write stuff in vi and then run it from plsql. It might barf if you have carriage returns within certain symbols like ( and ) or { and } I'm not sure, but that should help you ( cuz then you don't have to look back through every line in the history to fix one line in the query).
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    36
    Rep Power
    12
    Thanks for replies. I found the problem. It was my bad typing. Sorry.

    By the way, I'm using psql on FreeBSD 4.8. Thanks again.

IMN logo majestic logo threadwatch logo seochat tools logo