Mysql Sql Error 1048 Sqlstate 23000
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more mysql error code 1048. column cannot be null about Stack Overflow the company Business Learn more about hiring developers or posting ads error code 1048 in mysql with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow column cannot be null mysql is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ERROR 1048 (23000) Column cannot be NULL, however I am inserting valid sql error 1048 sqlstate 23000 hibernate data up vote 5 down vote favorite There are tons of these posts on Stack Overflow, however from the 20 or so that I looked at they were either coding errors faced when interfacing with MySQL (which I am not trying to do) or simply wanted null values but had their table defined incorrectly. I am seeing an error in MySQL 5.6.19 where I have a column that is
Error Number 1048 Column Cannot Be Null In Codeigniter
not allowed to have a null value. This is fine as it shouldn't have a null value. Here is the table desc below. mysql> describe z; +-------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+----------+------+-----+---------+----------------+ | a | int(11) | NO | PRI | NULL | auto_increment | | data | char(30) | NO | | NULL | | | t | datetime | YES | | NULL | | +-------+----------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) My problem is that I am inserting valid data.... mysql> insert into z (data, t) values('helloworld', sysdate()); ERROR 1048 (23000): Column 'data' cannot be null There is one other piece of information that might be of some concern... or may not be. I have a trigger and procedure that execute upon the implementation of inserts into this column. However I don't see that it should be a problem due to the trigger being activated after the insert statement completes. Here is the trigger: mysql> show triggers\G *************************** 1. row *************************** Trigger: insertuser Event: INSERT Table: z Statement: begin call triggerproc(sysdate(),user(),(select data from z where a = last_insert_id())); end Timing: AFTER Created: NULL sql_mode: NO_ENGINE_SUBSTITUTION Definer: root@localhost character_set_client: utf8 collation_connection: utf8_general_ci Database Collation: latin1_swedis
Local Community Meetups Laravel.io Site and Community Forum Authentication, Views SQLSTATE[23000] - Column 'user_id' cannot be null Hey guys, I followed this great tutorial to implement FB
Mysql Error 1048 Column Cannot Be Null
login into my application: http://maxoffsky.com/code-blog/integrating-facebook-login-into-laravel-application/ However, im struggling with saving the user to mysql error codes my existing table, and I am wondering if it's because the "profiles" table is referencing a wrong table? I have sqlstate 23000 integrity constraint violation 1048 column cannot be null a "user" table that I currently use to store my users in (note: not the same as the users table used in the tutorial), but when I try to store my user, i http://stackoverflow.com/questions/25154105/error-1048-23000-column-cannot-be-null-however-i-am-inserting-valid-data get the following error from my sql db: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_id' cannot be null (SQL: insert into `profiles` (`uid`, `username`, `user_id`, `updated_at`, `created_at`) Any pointers? Could it be my models that reference to the wrong tables? Kind regards, Casper. Reached 2 years ago lagbox 2 years ago you are trying to insert a null value into the user_id field of profiles http://laravel.io/forum/04-20-2014-sqlstate23000-column-user-id-cannot-be-null table. just make sure it isn't null. felipepodesta 2 years ago In your migration: /* * Engine */ $table->engine = 'InnoDB'; /* * Fields */ $table->integer('user_id')->unsigned()->nullable(); /* * Foreign Keys */ $table->foreign('user_id', 'relation_user_id') ->references('id') ->on('users') ->onUpdate('cascade') ->onDelete('cascade'); Reached 2 years ago Hey Felipe! I implemented your suggestion, and I got passed the error, only to be thrown a new one; ErrorException Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Auth\UserInterface, null given What seems to be the issue here? Since it says "null given" I assume its the null value that makes trouble now? Thank you! EDIT The user has been added to the database, however the error above still persists. EDIT #2 I suspect that its my user model that cause the trouble, since i am using the ConfideUser class to login my users. This is my model:
Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: Object https://coderanch.com/t/614787/databases/Hibernate-inserting-rows Relational Mapping Hibernate not inserting rows Rav Nomula Greenhorn Posts: https://www.drupal.org/node/1230506 6 posted 3 years ago I able to generate the schema but when I try to insert, I am getting the error com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null. My Phone table primary key is a composite key consisting of phoneNumber and foreign sql error key id. I have my classes as below Student.java import java.io.Serializable; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; @Entity @SuppressWarnings("serial") public class Student implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String fName; private String lName; private String mname; @OneToMany(cascade column cannot be = CascadeType.ALL) @JoinColumn(name = "id") private Set
that make connections all over the world. Join today Download & Extend Drupal Core Distributions Modules Themes AchievementsIssues SQL Errors "Integrity constraint violation: 1048 Column 'points' cannot be null:" Closed (fixed)Project:AchievementsVersion:7.x-1.x-devComponent:CodePriority:NormalCategory:Bug reportAssigned:UnassignedReporter:trillexCreated:July 26, 2011 - 22:23Updated:May 15, 2012 - 15:30 Log in or register to update this issue I've been playing around with this module but have been unable to get it to work properly and started ending up with this error: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'points' at row 1: UPDATE {achievement_totals} SET points=points + :points, unlocks=unlocks + :increment, timestamp=:db_update_placeholder_0 WHERE ( (uid = :db_condition_placeholder_0) ); Array ( [:points] => [:increment] => 1 [:db_update_placeholder_0] => 1311718169 [:db_condition_placeholder_0] => 1 ) in achievements_unlocked() (line 320 of .../sites/all/modules/achievements/achievements.module). My code is just, essentially, one of your test achievement (module is replaced by the name of my custom module): array( 'title' => t('Comments'), 'achievements' => array( 'comment-count-1' => array( 'title' => t('Posted 1 comment!'), 'description' => t('This is the start of something beautiful'), 'storage' => 'comment-count', 'points' => 5, ), 'comment-count-50' => array( 'title' => t('Posted 50 comments!'), 'description' => t("We no longer think you're a spam bot. Maybe."), 'storage' => 'comment-count', 'points' => 50, ), 'comment-count-100' => array( 'title' => t('Posted 100 comments!'), 'description' => t('But what about the children?!'), 'storage' => 'comment-count', 'points' => 100, ), ), ), ); return $achievements; } function module_comment_insert($comment) { $current_count = achievements_storage_get('comment-count', $comment->uid) + 1; achievements_storage_set('comment-count', $current_count, $comment->uid); foreach (array(1, 50, 100) as $count) { if ($curren