<div dir="ltr"><div><span style="font-family:monospace,monospace">Recently I installed the latest version of Ur/Web (20150412 release) on a new machine (using Postgres 9.4.1 on Debian 8 Jessie running on Amazon AWS EC2), and I am trying to run the Crud1 demo here:<br><br><a href="http://www.impredicative.com/ur/demo/crud1.html">http://www.impredicative.com/ur/demo/crud1.html</a><br><br>When I do:<br><br>./crud1.exe<br><br>I am getting the error:<br><br>Fatal initialization error: Table 'uw_crud1_t1' does not exist.<br><br>This seems strange, because I had previously been able to run this example using the earlier version of Ur/Web on another Debian machine using Postgres a few months ago.<br><br>Since I am using Postgres, I'm not sure if the discussions at these links (regarding MySQL) are applicable:<br><br><a href="http://www.impredicative.com/pipermail/ur/2015-January/001834.html">http://www.impredicative.com/pipermail/ur/2015-January/001834.html</a><br><a href="http://www.impredicative.com/pipermail/ur/2015-April/001929.html">http://www.impredicative.com/pipermail/ur/2015-April/001929.html</a><br><br>I am using the following files from the Crud1 demo (with a slight modification to file crud1.urp):<br><br>admin:~/wrk/crud1$ ls -l<br><br>total 60<br>-rwxr-xr-x 1 admin admin 35088 May 16 03:45 crud1.exe<br>-rw-r--r-- 1 admin admin   290 May 16 03:45 crud1.sql<br>-rw-r--r-- 1 admin admin   460 May 16 02:17 crud1.ur<br>-rw-r--r-- 1 admin admin    48 May 16 02:19 crud1.urp<br>-rw-r--r-- 1 admin admin  6148 May 16 02:17 crud.ur<br>-rw-r--r-- 1 admin admin   953 May 16 02:16 crud.urs<br><br>I had changed the file crud1.urp, so that it would now read as follows (I changed both occurrences of 'test' to 'crud1'):<br><br>admin:~/wrk/crud1$ cat crud1.urp<br><br>database dbname=crud1<br>sql crud1.sql<br><br>crud<br>crud1<br><br>To compile, I used the command:<br><br>admin:~/wrk/crud1$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=xxxxxxxx dbname=crud1" crud1<br><br>Here is generated file crud1.sql:<br><br>admin:~/wrk/crud1$ cat crud1.sql<br><br>CREATE TABLE uw_Crud1_t1(uw_id int8 NOT NULL, uw_a int8 NOT NULL,<br>                          uw_b text NOT NULL, uw_c float8 NOT NULL,<br>                          uw_d bool NOT NULL,PRIMARY KEY (uw_id)<br><br> );<br><br> CREATE SEQUENCE uw_Crud1_seq;<br><br>===<br><br>I am logged in as user 'admin' on this machine (Debian 8 Jessie running on Amazon EC2).<br><br>I did the following to switch to user 'postgres' and create the database 'crud1' and the (Postgres) user 'admin' and grant all privileges on database 'crud1' to user 'admin':<br><br>admin:~/wrk/crud1$ sudo -i<br><br>root$ su - postgres<br><br>postgres:~$ createdb crud1<br><br>postgres:~$ psql -f /home/admin/wrk/crud1/crud1.sql crud1<br><br>postgres:~$ psql<br><br>psql (9.4.1)<br>Type "help" for help.<br><br>postgres=# create user admin with password 'xxxxxxxx';<br><br>postgres=# grant all on database crud1 to admin;<br><br>The following command shows that user 'admin' appears to have "access privileges" on database 'crud1':<br><br>postgres=# \l<br><br>   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges<br>-----------+----------+----------+-------------+-------------+-----------------------<br> crud1     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +<br>           |          |          |             |             | postgres=CTc/postgres+<br>           |          |          |             |             | admin=CTc/postgres<br> postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |<br> template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +<br>           |          |          |             |             | postgres=CTc/postgres<br> template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +<br>           |          |          |             |             | postgres=CTc/postgres<br>(4 rows)<br><br>The following shows that table 'uw_crud1_t1' *does* exist:<br><br>postgres=# \c crud1<br><br>crud1=# \d<br>              List of relations<br> Schema |     Name     |   Type   |  Owner<br>--------+--------------+----------+----------<br> public | uw_crud1_seq | sequence | postgres<br> public | uw_crud1_t1  | table    | postgres<br>(2 rows)<br><br>crud1=# select * from uw_crud1_t1;<br> uw_id | uw_a | uw_b | uw_c | uw_d<br>-------+------+------+------+------<br>(0 rows)<br><br>So it appears that:<br><br>- the database 'crud1' exists<br>- the user 'admin' with password 'xxxxxxxx' exists and has all privileges on database 'crud1'<br>- the table 'uw_crud1_t1' exists - and its name is all lowercase<br><br>Note: As shown in the results of doing 'cat crud1.sql' above, the file crud1.sql did use an uppercase "C" in the table name:<br><br>CREATE TABLE uw_Crud1_t1(uw_id int8 NOT NULL, uw_a int8 NOT NULL,<br>                          uw_b text NOT NULL, uw_c float8 NOT NULL,<br>                          uw_d bool NOT NULL,PRIMARY KEY (uw_id)<br><br> );<br><br>However, according to results of doing '\l' in psql above, the table name ended up being all lowercase for some reason.<br><br>As a final attempt, I did the following in psql, to grant all privileges on database 'crud1' to everyone (not just to user 'admin'):<br><br>postgres=# grant all on database crud1 to public;<br><br>Then I recompiled:<br><br>admin:~/wrk/crud1$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=pgasdfASDF123 dbname=crud1" crud1<br><br>But I still got the same error:<br><br>admin:~/wrk/crud1$ ./crud1.exe<br>Fatal initialization error: Table 'uw_crud1_t1' does not exist.<br><br>===<br><br>I also tried doing this same test with the demo 'Sql':<br><br><a href="http://www.impredicative.com/ur/demo/sql.html">http://www.impredicative.com/ur/demo/sql.html</a><br><br>This time I didn't change anything in the .urp, .urs and .ur files - using them exactly as-is.<br><br>I got the same results:<br><br>admin:~/wrk/sql$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=xxxxxxxx dbname=test" sql<br><br>admin:~/wrk/sql$ sudo -i<br><br>root$ su - postgres<br><br>postgres:/home/admin/wrk/sql$ createdb test<br><br>postgres:/home/admin/wrk/sql$ psql -f /home/admin/wrk/sql/sql.sql test<br>CREATE TABLE<br><br>postgres:/home/admin/wrk/sql$ psql<br>psql (9.4.1)<br>Type "help" for help.<br><br>postgres=# grant all on database test to admin;<br>GRANT<br><br>postgres=# \l<br>                                  List of databases<br>   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges<br>-----------+----------+----------+-------------+-------------+-----------------------<br> crud1     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =CTc/postgres        +<br>           |          |          |             |             | postgres=CTc/postgres+<br>           |          |          |             |             | admin=CTc/postgres<br> postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |<br> template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +<br>           |          |          |             |             | postgres=CTc/postgres<br> template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +<br>           |          |          |             |             | postgres=CTc/postgres<br> test      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +<br>           |          |          |             |             | postgres=CTc/postgres+<br>           |          |          |             |             | admin=CTc/postgres<br>(5 rows)<br><br>postgres=#<br><br>admin:~/wrk/sql$ ./sql.exe<br>Fatal initialization error: Table 'uw_sql_t' does not exist.<br><br>admin:~/wrk/sql$ cat sql.sql<br>CREATE TABLE uw_Sql_t(uw_a int8 NOT NULL, uw_b float8 NOT NULL,<br>                       uw_c text NOT NULL, uw_d bool NOT NULL,<br> PRIMARY KEY (uw_a)<br><br> );<br><br>===<br><br>One thing that seems strange is that the program outputs an error message using *all-lowercase* in the table name:<br><br>Fatal initialization error: Table 'uw_sql_t' does not exist.<br><br>But the generated .sql file uses *camelcase* in the table name:<br><br>CREATE TABLE uw_Sql_t(uw_a int8 NOT NULL, uw_b float8 NOT NULL,<br>                       uw_c text NOT NULL, uw_d bool NOT NULL,<br> PRIMARY KEY (uw_a)<br><br> );<br><br>The only guesses I have about what might be going wrong would be the following - but I'm not sure:<br><br>- The urweb compiler may be using the wrong case (camelcase or lowercase) somewhere?<br><br>- There may be something wrong with the privileges or the with Postgres password for the user 'admin'?<br><br></span></div><span style="font-family:monospace,monospace">- There may be some confusion between the *Postgres* user 'admin' and the *Debian* user 'admin'?<br></span><div><span style="font-family:monospace,monospace"><br>Thanks for any help!<br><br>###<br><br><br><br><br><br><br></span></div></div>