comp.lang.ada
 help / color / mirror / Atom feed
* Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
@ 2014-03-23 20:24 ake.ragnar.dahlgren
  2014-03-23 22:26 ` Simon Wright
  2014-03-23 22:31 ` Alan Browne
  0 siblings, 2 replies; 9+ messages in thread
From: ake.ragnar.dahlgren @ 2014-03-23 20:24 UTC (permalink / raw)


Maybe Ada software developers should avoid development on Mac OS X?

I've updated the version of Mac OS X to Mavericks. A consequence of updating the Mac OS X version is that I've had to reinstall my Ada software development environment. While searching information on the internet about this I've read that whenever you upgrade your version of Mac OS X, header files that gcc needs will be deleted and that you have to reinstall the command line tools for XCode. To get the command line tools back execute "/usr/bin/xcode-select --install".

After the upgrade to Mavericks I've installed GNAT GPL 2013 again and XAdaLib for Mavericks. Everything works well except for creation of tables in PostgreSQL.

On my Macbook Air the command gnatcoll_db2ada gives an error message when trying to create the tables in an empty database:
gnatcoll_db2ada -dbmodel=database_schema.txt -dbhost=localhost -dbport=5432 -dbname=hello -dbuser=postgres -dbpasswd=asdf -createdb

The response is:
[SQL.ERROR] 1/2 Transaction failed: BEGIN PGRES_BAD_RESPONSE 
[SQL.ERROR] 2/3 Transaction failed: ROLLBACK PGRES_BAD_RESPONSE

The file database_schema.txt contains the following content:
| TABLE   | People           | Person    |         |                        |
| id      | AUTOINCREMENT    | PK        |         | Auto-generated ID      |
| age     | INTEGER          |           |         |                        |
| name    | TEXT             |           |         |                        |

I've spent two work days trying to get the SQL binding in GNATColl to work. I am about to give up and buy a new laptop with Windows on it.

I've tried removing XAdaLIB and compiling GNATColl from Source. I've had no problem recompiling GNATColl. Executing gnatcoll_db2ada gives the error message above. Running the tests for GNATColl reveals the same error message (make test). I've reinstalled PostgreSQL 9.3.4 from both Enterprise DB and Macports. Still no success. Maybe the problem has something to do with permissions?

Is there someone on comp.lang.ada that has faced these challenges before and been more successful?

Best regards,
Åke Ragnar Dahlgren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-23 20:24 Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4 ake.ragnar.dahlgren
@ 2014-03-23 22:26 ` Simon Wright
  2014-03-25  0:51   ` ake.ragnar.dahlgren
  2014-03-23 22:31 ` Alan Browne
  1 sibling, 1 reply; 9+ messages in thread
From: Simon Wright @ 2014-03-23 22:26 UTC (permalink / raw)


ake.ragnar.dahlgren@gmail.com writes:

> On my Macbook Air the command gnatcoll_db2ada gives an error message
> when trying to create the tables in an empty database:
> gnatcoll_db2ada -dbmodel=database_schema.txt -dbhost=localhost
> -dbport=5432 -dbname=hello -dbuser=postgres -dbpasswd=asdf -createdb

I tried using Postgres.app & Gnatcoll GPL 2013/GCC 4.8.1 (built on ML,
running on Mavericks, 10.9.2).

> The response is:
> [SQL.ERROR] 1/2 Transaction failed: BEGIN PGRES_BAD_RESPONSE 
> [SQL.ERROR] 2/3 Transaction failed: ROLLBACK PGRES_BAD_RESPONSE

Same result (bar the 1/2 and 2/3) whether Postgres was running or not,
and whether I used the right port or not.

-dbtype=sqlite did create the tables.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-23 20:24 Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4 ake.ragnar.dahlgren
  2014-03-23 22:26 ` Simon Wright
@ 2014-03-23 22:31 ` Alan Browne
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Browne @ 2014-03-23 22:31 UTC (permalink / raw)


On 2014.03.23, 16:24 , ake.ragnar.dahlgren@gmail.com wrote:

>
> I've spent two work days trying to get the SQL binding in GNATColl to
> work. I am about to give up and buy a new laptop with Windows on it.

If you can't get it to work, then you could nstall Fusion (or Parallels) 
on your Mac. Load Windblows (or Linux or ...) on top of that.  Run both 
OS' in parallel, drag/drop, copy/paste, etc. between them.

-- 
   Privacy has become an essential personal chore that most
   people are not trained to perform.
                  - Jaron Lanier, Scientific American, 2013.11.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-23 22:26 ` Simon Wright
@ 2014-03-25  0:51   ` ake.ragnar.dahlgren
  2014-03-25  7:38     ` Simon Wright
  0 siblings, 1 reply; 9+ messages in thread
From: ake.ragnar.dahlgren @ 2014-03-25  0:51 UTC (permalink / raw)


Thank you Simon and Alan for your thoughts and feedback.

To make a long story short I've managed to create the tables in the PostgreSQL database by exchanging the word "localhost" for 127.0.0.1:
gnatcoll_db2ada -dbmodel=database_schema.txt -dbhost=127.0.0.1 -dbport=5432 -dbname=hello -dbuser=postgres -dbpasswd=asdf -createdb

Perhaps someone can verify that this does the trick?

Best regards,
Åke Ragnar Dahlgren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-25  0:51   ` ake.ragnar.dahlgren
@ 2014-03-25  7:38     ` Simon Wright
  2014-03-25  8:04       ` ake.ragnar.dahlgren
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Wright @ 2014-03-25  7:38 UTC (permalink / raw)


ake.ragnar.dahlgren@gmail.com writes:

> To make a long story short I've managed to create the tables in the
> PostgreSQL database by exchanging the word "localhost" for 127.0.0.1:
> gnatcoll_db2ada -dbmodel=database_schema.txt -dbhost=127.0.0.1
> -dbport=5432 -dbname=hello -dbuser=postgres -dbpasswd=asdf -createdb
>
> Perhaps someone can verify that this does the trick?

I'm sure I tried that earlier! but it's fine now: having enabled
tracing, using Postgres.app, & with one of the examples from
gnatcoll. Perhaps 'localhost' is selecting the wrong transport layer?

$ ./gnatcoll_db2ada -dbhost=127.0.0.1 -dbport=5432 -dbname=hello -dbuser=simon -dbmodel=dbschema.txt -createdb
[SQL] 1/1 Connecting to the database dbname=hello user=simon host=127.0.0.1 port=5432 sslmode=allow ()
[SQL] 2/2 BEGIN (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 1/3 Finished executing query: 24.511000000 ms
   [SQL] 3/4 CREATE TABLE "customers" (
_SQL_  "id" SERIAL PRIMARY KEY NOT NULL,
_SQL_  "first" Text NOT NULL,
_SQL_  "last" Text NOT NULL) (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 2/5 Finished executing query: 863.374000000 ms
   [SQL] 4/6 CREATE TABLE "books" (
_SQL_  "pages" Integer DEFAULT 100,
_SQL_  "borrowed_by" Integer,
_SQL_  "id" SERIAL PRIMARY KEY NOT NULL,
_SQL_  "title" Text,
_SQL_  "author" Text,
_SQL_  "published" Date,
_SQL_  FOREIGN KEY ("borrowed_by") REFERENCES "customers" ("id")) (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 3/7 Finished executing query: 112.397000000 ms
   [SQL] 5/8 CREATE TABLE "dvds" (
_SQL_  "region" Integer DEFAULT 1,
_SQL_  "borrowed_by" Integer,
_SQL_  "id" SERIAL PRIMARY KEY NOT NULL,
_SQL_  "title" Text,
_SQL_  "author" Text,
_SQL_  "published" Date,
_SQL_  FOREIGN KEY ("borrowed_by") REFERENCES "customers" ("id")) (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 4/9 Finished executing query: 7.592000000 ms
   [SQL] 6/10 CREATE INDEX "customers_last_idx" ON "customers" ("last") (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 5/11 Finished executing query: 2.082000000 ms
   [SQL] 7/12 CREATE INDEX "books_borrowed_by_idx" ON "books" ("borrowed_by") (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 6/13 Finished executing query: 1.074000000 ms
   [SQL] 8/14 CREATE INDEX "dvds_borrowed_by_idx" ON "dvds" ("borrowed_by") (0 tuples) PGRES_COMMAND_OK
   [SQL.PERF] 7/15 Finished executing query: 1.251000000 ms
[SQL] 9/16 COMMIT (0 tuples) PGRES_COMMAND_OK
[SQL.PERF] 8/17 Finished executing query: 1138.720000000 ms

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-25  7:38     ` Simon Wright
@ 2014-03-25  8:04       ` ake.ragnar.dahlgren
  2014-03-25  8:39         ` Simon Wright
  0 siblings, 1 reply; 9+ messages in thread
From: ake.ragnar.dahlgren @ 2014-03-25  8:04 UTC (permalink / raw)


Thanks for verifying Simon. May I ask you how you enabled tracing? I have tried to do that by creating a file .gnatdebug only containing a plus sign "+" in the directory where the database_schema.txt file resided. It did not avail me and gnatcoll_db2ada was silent. I was successfull though with GPS when I put the .gnatdebug file in the same directory as the gpr-file; GPS started writing a lot of debug information to standard out.

Best regards,
Åke Ragnar Dahlgren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-25  8:04       ` ake.ragnar.dahlgren
@ 2014-03-25  8:39         ` Simon Wright
  2014-03-25  8:55           ` ake.ragnar.dahlgren
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Wright @ 2014-03-25  8:39 UTC (permalink / raw)


ake.ragnar.dahlgren@gmail.com writes:

> Thanks for verifying Simon. May I ask you how you enabled tracing? I
> have tried to do that by creating a file .gnatdebug only containing a
> plus sign "+" in the directory where the database_schema.txt file
> resided. It did not avail me and gnatcoll_db2ada was silent. I was
> successfull though with GPS when I put the .gnatdebug file in the same
> directory as the gpr-file; GPS started writing a lot of debug
> information to standard out.

I found the info about it on AdaCore's site[1]. My .gnatdebug says

+
>&2
SQL.ERROR
SQL.SELECT
SQL.CACHE
SQL.PERF
SQL

(I found out what to say from gnatcoll-sql-exec.adb).

[1] http://docs.adacore.com/gnatcoll-docs/traces.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-25  8:39         ` Simon Wright
@ 2014-03-25  8:55           ` ake.ragnar.dahlgren
  2014-03-25  9:24             ` Simon Wright
  0 siblings, 1 reply; 9+ messages in thread
From: ake.ragnar.dahlgren @ 2014-03-25  8:55 UTC (permalink / raw)


Many thanks Simon!

For anyone reading this at comp.lang.ada I would also like to share that using "localhost" worked fine on a Windows XP computer. It was when using it in Mac OS X that it did not work. Yesterday I followed Alans suggestion to try out Wmware's Fusion. I did that and installed Debian in a virtual machine, installed gnat by "aptitudu install gnat", installed postgresql using aptitude followed by downloading gnatcoll from the Libre AdaCore website, compiling it successfully and then getting the same error "Transaction failed: BEGIN PGRES_BAD_RESPONSE" when trying to create the tables. When specifying 127.0.0.1 instead of localhost it was possible to create the tables both in Debian and Mac OS X.

Best regards,
Åke Ragnar Dahlgren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4
  2014-03-25  8:55           ` ake.ragnar.dahlgren
@ 2014-03-25  9:24             ` Simon Wright
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Wright @ 2014-03-25  9:24 UTC (permalink / raw)


ake.ragnar.dahlgren@gmail.com writes:

> For anyone reading this at comp.lang.ada I would also like to share
> that using "localhost" worked fine on a Windows XP computer. It was
> when using it in Mac OS X that it did not work. Yesterday I followed
> Alans suggestion to try out Wmware's Fusion. I did that and installed
> Debian in a virtual machine, installed gnat by "aptitudu install
> gnat", installed postgresql using aptitude followed by downloading
> gnatcoll from the Libre AdaCore website, compiling it successfully and
> then getting the same error "Transaction failed: BEGIN
> PGRES_BAD_RESPONSE" when trying to create the tables. When specifying
> 127.0.0.1 instead of localhost it was possible to create the tables
> both in Debian and Mac OS X.

GNATCOLL uses PQconnectdb[1], which does its own magic with
host/hostaddr.

[1] http://www.postgresql.org/docs/8.3/static/libpq-connect.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-03-25  9:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-23 20:24 Mac OS X Mavericks does not play nice with PostgreSQL 9.3.4 ake.ragnar.dahlgren
2014-03-23 22:26 ` Simon Wright
2014-03-25  0:51   ` ake.ragnar.dahlgren
2014-03-25  7:38     ` Simon Wright
2014-03-25  8:04       ` ake.ragnar.dahlgren
2014-03-25  8:39         ` Simon Wright
2014-03-25  8:55           ` ake.ragnar.dahlgren
2014-03-25  9:24             ` Simon Wright
2014-03-23 22:31 ` Alan Browne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox