Comments in .sql files
От | Chad N. Tindel |
---|---|
Тема | Comments in .sql files |
Дата | |
Msg-id | 20030724043606.GA31855@calma.pair.com обсуждение исходный текст |
Ответы |
Re: Comments in .sql files
|
Список | pgsql-general |
Hi, Still working on converting our schemas over to postgres from mysql, and trying to get the hang of the differences between the two products. I'm trying to figure out how to put comments in our .sql schema files. For example: a.sql ----------------------- drop table A; create table A ( id SERIAL PRIMARY KEY, foo int default 5, bar int default 10 ); # This is a comment insert into A (foo, bar) values (1, 1); insert into A (foo, bar) values (2, 2); ------------------------- Running "psql --username=user -d DB < a.sql" yields the following result: DROP TABLE NOTICE: CREATE TABLE will create implicit sequence 'a_id_seq' for SERIAL column 'a.id' NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'a_pkey' for table 'a' CREATE TABLE ERROR: parser: parse error at or near "#" at character 1 INSERT 66820 1 ------------------ And the DB only shows the second entry: Portal=# select * from A; id | foo | bar ----+-----+----- 1 | 2 | 2 (1 row) ---------------- So, my questions are: 1. It obviously doesn't like the # notation for comments. What is the proper way to put comments in schema files? 2. Why does postgres ignore the first insert? Shouldn't it just barf on the "#" line and keep going? 3. Is there a way to turn of the notices about creating implicit sequences and indices? Thanks, Chad
В списке pgsql-general по дате отправления: