I have a query:
INSERT INTO tr_projects () VALUES ()
which errors. In another thread I found that this will error UNLESS there are default values specified for every column in tr_projects.
There are in fact default values specified; there are 2 (there are 2 columns in tr_projects) and they are:
1) nextval('tr_projects_id_seq'::regclass)
2) 0
But when I run the query, it errors:
Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near ")" LINE 1: INSERT INTO tr_projects () VALUES () ^ in C:\Program Files\BitNami WAPPStack\apache2\htdocs\ascprojects\tracker\pgsql_database.php on line 186
Is there a setting I have to change in PGSQL to make it use the default values automatically? Why doesnt it take the default values specified?
Devault values for Row in PGSQL
Moderator: General Moderators
- volomike
- Forum Regular
- Posts: 633
- Joined: Wed Jan 16, 2008 9:04 am
- Location: Myrtle Beach, South Carolina, USA
Re: Devault values for Row in PGSQL
Try:
INSERT INTO tr_projects VALUES ()
?
Just guessing.
INSERT INTO tr_projects VALUES ()
?
Just guessing.
Re: Devault values for Row in PGSQL
Thanks for the reply 
I got it resolved, incase anyone else wants to know:
INSERT INTO table_name(column_name, column_name,...) VALUES(DEFAULT, DEFAULT,...)
I got it resolved, incase anyone else wants to know:
INSERT INTO table_name(column_name, column_name,...) VALUES(DEFAULT, DEFAULT,...)
- volomike
- Forum Regular
- Posts: 633
- Joined: Wed Jan 16, 2008 9:04 am
- Location: Myrtle Beach, South Carolina, USA
Re: Devault values for Row in PGSQL
Really? So using the word DEFAULT without quotes around it -- that works? Surprising.
Re: Devault values for Row in PGSQL
Yea, I guess its a built in feature to PGSQL.