草庐IT

CONSTRAINT

全部标签

python - django.db.utils.IntegrityError : duplicate key value violates unique constraint "django_content_type_pkey"

遇到了一点问题,当我运行“pythonmanage.pysyncdb”时,我收到了上述错误消息,我在一个相当旧的站点上工作。它使用postgresDB运行django1.2.6。运行没有安装南,我设法让它工作。Ranpythonmanage.pyschemamigration--initialcontact_enquiries运行良好并要求我迁移。然后我运行pythonmanage.pymigratecontact_enquiries然后我得到了和上面一样的错误。它没有提示我的模型中的任何语法,这就是我感到困惑的原因。这是我的模型,希望能有所启发。fromdjango.dbimport

java - Spring java.lang.LinkageError : loader constraint violation: loader previously initiated loading for a different type with name X

我是Spring新手并使用Spring3.2.2。我有一些通过注入(inject)的bean效果很好。现在我想通过@Autowired注入(inject)一些bean这完全出错了。我已经这样做了:beans.xml:Java源代码:@Autowired@Qualifier("formulaFactory")privateFormulaFactoryformulaFactory;(更改限定符或将其排除在外没有任何区别......)我得到这个错误:java.lang.LinkageError:loaderconstraintviolation:loader(instanceoforg/sp

MySQL:ALTER IGNORE TABLE 给出 "Integrity constraint violation"

我正在尝试使用ALTERIGNORETABLE+UNIQUEKEY从MySQL表中删除重复项。MySQL文档说:IGNOREisaMySQLextensiontostandardSQL.ItcontrolshowALTERTABLEworksifthereareduplicatesonuniquekeysinthenewtableorifwarningsoccurwhenstrictmodeisenabled.IfIGNOREisnotspecified,thecopyisabortedandrolledbackifduplicate-keyerrorsoccur.IfIGNOREis

mysql - 无法删除或更新父行 : a foreign key constraint fails

做的时候:DELETEFROM`jobs`WHERE`job_id`=1LIMIT1错误:#1451-Cannotdeleteorupdateaparentrow:aforeignkeyconstraintfails(paymesomething.advertisers,CONSTRAINTadvertisers_ibfk_1FOREIGNKEY(advertiser_id)REFERENCESjobs(advertiser_id))这是我的table:CREATETABLEIFNOTEXISTS`advertisers`(`advertiser_id`int(11)unsignedN

Mysql 错误 1452 - 无法添加或更新子行 : a foreign key constraint fails

我遇到了一个奇怪的问题。我正在尝试将外键添加到一个引用另一个表的表中,但由于某种原因它失败了。由于我对MySQL的了解有限,唯一可能怀疑的是在另一个表上存在一个外键,该外键引用了我试图引用的表。我对两个表都做了SHOWCREATETABLE查询,sourcecodes_tags是带有外键的表,sourcecodes是被引用的表。CREATETABLE`sourcecodes`(`id`int(11)unsignedNOTNULLAUTO_INCREMENT,`user_id`int(11)unsignedNOTNULL,`language_id`int(11)unsignedNOTNU

ios - 在自动布局中将 subview 的 X 居中抛出 "not prepared for the constraint"

我有一个自定义UIView子类,它正在通过nib初始化。在-awakeFromNib中,我正在创建一个subview并尝试将其置于其父View的中心。[selfsetInteralView:[[UIViewalloc]init]];[[selfinternalView]addConstraint:[NSLayoutConstraintconstraintWithItem:[selfinternalView]attribute:NSLayoutAttributeCenterXrelatedBy:NSLayoutRelationEqualtoItem:selfattribute:NSLay

ruby - 错误 : null value in column "id" violates not-null constraint

我刚刚将我的应用程序从mysql迁移到postgres但是当我尝试在特定表中插入记录时我得到violatesnot-nullconstraint错误:ERROR:nullvalueincolumn"id"violatesnot-nullconstraintDETAIL:Failingrowcontains(null,1,1,null,null,null,2016-03-0909:24:12.841891,2012-12-3123:00:00,2012-12-3123:00:00,null,null,f,null,f,XYZAssignment,null,null,null,null).

ruby-on-rails - heroku 上的 Rails : after push, 得到 "PG::UniqueViolation: ERROR: duplicate key value violates unique constraint"

这已经被问过好几次了(here和here等等)。每次我将我的Rails应用程序推送到Heroku时(至少在过去的几个月里,我会说),我都必须使用熟悉的方法重置我的keyActiveRecord::Base.connection.tables.each{|t|ActiveRecord::Base.connection.reset_pk_sequence!(t)}咒语。否则,当我尝试创建新记录时,我会遇到这样的postgresql故障:PG::UniqueViolation:ERROR:duplicatekeyvalueviolatesuniqueconstraint"users_clie

ruby-on-rails - 使用 add_foreign_key : 'column "user_id"referenced in foreign key constraint does not exist' 进行 Rails 迁移

(Rails是5.0.0版本,Ruby是2.3.0p0)我想在我的用户表和卡片表之间创建关联。我已将belongs_to:user添加到Cards模型,并将has_many:cards添加到Users模型,并创建了一个迁移:classAddUserIdToCard当我运行rakedb:migrate时,我收到错误:ActiveRecord::StatementInvalid:PG::UndefinedColumn:ERROR:column"user_id"referencedinforeignkeyconstraintdoesnotexist:ALTERTABLE"cards"ADDC

openGauss中创建唯一索引和创建唯一约束的区别

今天一个一起搬砖的兄弟同事过来问,为什么他的索引删不掉?我过去看了下:执行脚本:dropindexconstraint_unique报错如下:执行时出错确认要继续执行吗?单击“详细信息”了解详情。SQL错误码:=2BP01ERROR:cannotdropindexconstraint_uniquebecauseconstraintconstraint_uniqueontablet1requiresitHint:Youcandropconstraintconstraint_uniqueontablet1instead.行号:19报错大意是:不能删除索引constraint_unique因为约束c