@@ -54,6 +54,17 @@ You have to define one or more tables where your data should end up. This
5454is done with the ` osm2pgsql.define_table() ` function or one of the slightly
5555more convenient functions ` osm2pgsql.define_(node|way|relation|area)_table() ` .
5656
57+ ```
58+ osm2pgsql.define_table(OPTIONS)
59+
60+ osm2pgsql.define_(node|way|relation|area)_table(NAME, COLUMNS[, OPTIONS])
61+ ```
62+
63+ Here NAME is the name of the table, COLUMNS is a list of Lua tables describing
64+ the columns as documented below. OPTIONS is a Lua table with options for
65+ the table as a whole. When using the ` define_table() ` command, the NAME and
66+ COLUMNS are specified as options "name" and "columns", respectively.
67+
5768Each table is either a * node table* , * way table* , * relation table* , or * area
5869table* . This means that the data for that table comes primarily from a node,
5970way, relation, or area, respectively. Osm2pgsql makes sure that the OSM object
@@ -66,10 +77,11 @@ With the `osm2pgsql.define_table()` function you can also define tables that
6677* don't have any ids, but those tables will never be updated by osm2pgsql
6778* take * any OSM object* , in this case the type of object is stored in an
6879 additional column.
69- * are in a specific PostgresSQL tablespace (set ` data_tablespace ` ) or that
70- get their indexes created in a specific tablespace (set ` index_tablespace ` ).
71- * are in a specific schema (set ` schema ` ). Note that the schema has to be
72- created before you start osm2pgsql.
80+ * are in a specific PostgresSQL tablespace (set option ` data_tablespace ` ) or
81+ that get their indexes created in a specific tablespace (set option
82+ ` index_tablespace ` ).
83+ * are in a specific schema (set option ` schema ` ). Note that the schema has to
84+ be created before you start osm2pgsql.
7385
7486If you are using the ` osm2pgsql.define_(node|way|relation|area)_table() `
7587convenience functions, osm2pgsql will automatically create an id column named
@@ -105,11 +117,16 @@ Instead of the above types you can use any SQL type you want. If you do that
105117you have to supply the PostgreSQL string representation for that type when
106118adding data to such columns (or Lua nil to set the column to ` NULL ` ).
107119
108- When defining a column you can add the following options:
109- * ` not_null = true ` : Make this a ` NOT NULL ` column.
120+ In the table definitions the columns are specified as a list of Lua tables
121+ with the following keys:
122+
123+ * ` column ` : The name of the PostgreSQL column (required).
124+ * ` type ` : The type of the column as described above (required).
125+ * ` not_null = true ` : Make this a ` NOT NULL ` column. (Optional, default ` false ` .)
110126* ` create_only = true ` : Add the column to the ` CREATE TABLE ` command, but
111127 do not try to fill this column when adding data. This can be useful for
112128 ` SERIAL ` columns or when you want to fill in the column later yourself.
129+ (Optional, default ` false ` .)
113130
114131### Processing callbacks
115132
0 commit comments