?
Solved

"filename" violates not null constraint

Posted on 2009-02-23
6
Medium Priority
?
633 Views
Last Modified: 2012-05-06
what is this error message mean?

DBD:: PgPP:: st execute failed: ERROR: null value in column "filename: violates not-null constraint
0
Comment
Question by:tankergoblin
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:mahome
ID: 23719173
This means that you wanted to execute a statment (insert or update) which wanted to set the a null value into the column "filename". But you have a not null constraint on that column, therefore this is not allowed.
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 23719204
you mean the column is not allow null?
0
 
LVL 10

Expert Comment

by:mahome
ID: 23719256
Yes the column does not allow null values.
You can verfiy that: Login with psql and type:
\d <tablename>

Than you get a output like the following for example:

As you see, in the third column is the hint if it is a not null column.

                 Table »public.appuser«
     Column      |             Type            | Attribute 
-----------------+-----------------------------+-----------
 appuser_id      | bigint                      | not null
 created_at      | timestamp without time zone | 
 changed_at      | timestamp without time zone | 
 username        | character varying(50)       | not null
...

Open in new window

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LVL 7

Author Comment

by:tankergoblin
ID: 23719355

yes the column is not allowed null. How to correct the error message?
0
 
LVL 10

Accepted Solution

by:
mahome earned 2000 total points
ID: 23719428
You can remove the not null constraint with the following.

But before be sure that you want to allow null values in that column and you do not have a problem with your statement.

ALTER TABLE <mytable>
ALTER filename DROP NOT NULL

Open in new window

0
 
LVL 7

Author Comment

by:tankergoblin
ID: 23719551
if i want to remain the column to be not null. what can i do with my code to get the same result as previous one with ?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question