Search Postgresql Archives

Re: Where do I enter commands?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/25/2015 07:57 AM, David Blomstrom wrote:
It's hard to imagine creating a table with a command-line tool - in the
step-by-step process I use with phpMyAdmin, that is. If you can learn
the proper syntax for creating a table and put together a script for a
generic table that you can easily modify, then maybe it would be a lot
easier with a command-line tool.

In phpMyAdmin, I've become accustomed to simply copying existing tables,
then adding, deleting and renaming columns as needed.

In psql:

test=> CREATE TABLE orig_test(id integer, fld_1 varchar, fld_2 boolean, fld_3 numeric(7,3));
CREATE TABLE

test=> \d orig_test
Table "public.orig_test"
Column | Type | Modifiers
--------+-------------------+-----------
id | integer |
fld_1 | character varying |
fld_2 | boolean |
fld_3 | numeric(7,3) |

test=> create table cp_test AS select * from orig_test ;
SELECT 0

test=> \d cp_test
Table "public.cp_test"
Column | Type | Modifiers
--------+-------------------+-----------
id | integer |
fld_1 | character varying |
fld_2 | boolean |
fld_3 | numeric(7,3) |

test=> alter table cp_test add column fld_4 date;
ALTER TABLE
test=> \d cp_test
         Table "public.cp_test"
 Column |       Type        | Modifiers
--------+-------------------+-----------
 id     | integer           |
 fld_1  | character varying |
 fld_2  | boolean           |
 fld_3  | numeric(7,3)      |
 fld_4  | date              |

One note, in Postgres new columns will always be added to end of table.


I can see PostgreSQL is going to have a learning curve - hopefully
shorter than the years it took me to learn MySQL - but it looks
interesting. The community seems painfully small compared to MySQL, and
there are less online resources. But I'm guessing that will change in
the coming years. I remember when CSS was a strange, foreign thing. ;)

Last time I there was a count on the people on this mailing list I remember a number of 33,000-34,000.


On Sun, Oct 25, 2015 at 6:28 AM, Adrian Klaver
<adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>> wrote:

    On 10/24/2015 09:19 PM, David Blomstrom wrote:

        I'm a writer. I studied programing and MySQL so I could create
        websites
        that I can publish my articles to. I don't have time to keep up
        with the
        endless technology - MySQL, PDO, stored procedures, PHP, JavaScript,
        JQuery, and on and on - especially when I have to work for a living.
        I've been using MySQL for years, so I'm familiar with it. It
        therefore
        makes sense for me to find a GUI as similar to MySQL as possible.

        With phpMyAdmin, I can easily create, modify, copy and migrate
        tables
        between databases. If that can be done as easily with a
        command-line-tool, even after surviving the learning curve, then I'm
        interested. But it's really hard to imagine how that could be.


    pgAdmin will allow you to do those things. phpPgAdmin also, though I
    have never used it, so I can not be of much help there. The
    predominate command line tool folks are referring to is psql:

    http://www.postgresql.org/docs/9.4/interactive/app-psql.html

    For dumping databases or their contained objects there is pg_dump:

    http://www.postgresql.org/docs/9.4/interactive/app-pgdump.html

    for restoring non-plain text dumps there is pg_restore

    http://www.postgresql.org/docs/9.4/interactive/app-pgdump.html

    for plain text dumps just use psql.

    These three programs will cover most of your use cases. The benefit
    to using these tools is that you end of working with scripts that
    then can be put under version control. Takes a little bit of time to
    set up but the payoff is worth it for anything above the really
    simple level.


        Thanks for the tips.

        On Sat, Oct 24, 2015 at 9:07 PM, Adrian Klaver
        <adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
        <mailto:adrian.klaver@xxxxxxxxxxx
        <mailto:adrian.klaver@xxxxxxxxxxx>>> wrote:

             On 10/24/2015 08:52 PM, Rob Sargent wrote:

                 ok. now who has the url to the pithy
                 heres-why-you-/really/-want-the-command-line.

                 It distills to something about actually knowing what
        you’re doing.


             Everyone has to start somewhere. The point is get someone using
             Postgres in manner they are comfortable with, then they can
        start
             exploring the possibilities. I personally find the command
        line more
             productive, but there is a learning curve.





             --
             Adrian Klaver
        adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
        <mailto:adrian.klaver@xxxxxxxxxxx
        <mailto:adrian.klaver@xxxxxxxxxxx>>




        --
        David Blomstrom
        Writer & Web Designer (Mac, M$ & Linux)
        www.geobop.org <http://www.geobop.org> <http://www.geobop.org>



    --
    Adrian Klaver
    adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>




--
David Blomstrom
Writer & Web Designer (Mac, M$ & Linux)
www.geobop.org <http://www.geobop.org>


--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux