Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2009
    Posts
    4

    Unanswered: PostgreSQL sample database

    All, I am new in PostgreSQL. I am VS.NET developer and I am interesting to see if this database is good enough for my programs. I do not know if there is a sample database in order to check all these functionalities that PostgreSQL has.
    Can anyone help me on these?

    Thanks in advance

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    If you have an older version (pre-2007) of MS Access handy, try the attached VBA code (run it against Northwind, for instance.) It will generate SQL to create the tables in several different database flavors, including pg.

    After creating the module & pasting the code into it, follow the directions in the comments at the start of the module.

    When you run the code, by default, it creates three files in the c:\temp folder: esql_create.sql, esql_del.sql, and esql_add.sql. The create script is the SQL to create the tables; the del script will delete the tables, and the add script will populate the tables created.

    Review the SQL, addressing any warnings that the script may have added as comments, and execute it from psql or pgAdmin.

    One shortcoming that module has (and I've never fixed) is blob types; it doesn't recognize images and the like. And, while I got it to run in Access 2007, there are some issues with it in that environment...
    Attached Files Attached Files
    Last edited by loquin; 08-10-09 at 16:38.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  4. #4
    Join Date
    Aug 2009
    Posts
    4
    Can someone tell me why this is not working?

    CREATE TABLE city (
    id integer NOT NULL,
    name text NOT NULL,
    countrycode character(3) NOT NULL,
    district text NOT NULL,
    population integer NOT NULL
    );

    COPY city (id, name, countrycode, district, population) FROM stdin;
    1 Kabul AFG Kabol 1780000
    2 Qandahar AFG Qandahar 237500
    3 Herat AFG Herat 186800
    4 Mazar-e-Sharif AFG Balkh 127800
    5 Amsterdam NLD Noord-Holland 731200
    6 Rotterdam NLD Zuid-Holland 593321
    \.

    It stops in line: 1 Kabul AFG Kabol 1780000
    and
    The error is: [ERROR ] 10.0: syntax error, unexpected INTEGER VALUE

    Thanks

  5. #5
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    My guess is you are trying to run it thru some gui client and not psql.

    Try:
    psql (connect params) world < world.sql

  6. #6
    Join Date
    Aug 2009
    Posts
    4
    Thanks a lot for your help.
    I want to start to use PostGreSQL with my .NET programs. I hope that it will be not a waste of time. I hope that I can find help and answers to my questions and problems. From what I have seen in the internet is that there is no big support (forums or the main site).

    Lets see if I will manage.

    Anyway thanks again
    Elias

  7. #7
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by ekekakos
    From what I have seen in the internet is that there is no big support
    You'll get excellent support from the mailing lists (which are listed on the Postgres web site).
    The core development team is reading and answering questions there, so there is no better place to ask.

  8. #8
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    try putting commas between the field data and wrapping text with apostrophes (')
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  9. #9
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    Quote Originally Posted by loquin
    try putting commas between the field data and wrapping text with apostrophes (')
    Actually you don't need (or want) to do that. The file is formatted so that the psql client treats everything between ...FROM stdin; to \. as if it was piped into the copy command. But as op found out, it only works for psql.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •