rules

Why doesn't this rule prevent duplicate key violations?

自古美人都是妖i 提交于 2019-12-04 03:36:51
(postgresql) I was trying to COPY csv data into a table but I was getting duplicate key violation errors, and there's no way to tell COPY to ignore those, so following internet wisdom I tried adding this rule: CREATE OR REPLACE RULE ignore_duplicate_inserts AS ON INSERT TO mytable WHERE (EXISTS ( SELECT mytable.id FROM mytable WHERE mytable.id = new.id)) DO NOTHING; to circumvent the problem, but I still get those errors - any ideas why ? Rules by default add things to the current action : Roughly speaking, a rule causes additional commands to be executed when a given command on a given table

PostgreSQL's rules and nextval()/serial problem (very PostgreSQL-specific)

删除回忆录丶 提交于 2019-12-04 01:13:37
When I use a rewrite rule that splits an insert into one table into inserts to two other tables where one of the inserted values has as default nextval('some_sequence') with the same sequence for both tables, then the inserted default values are different in the two tables. This is probably due to simple text replacement by the rewrite rule. I had hoped instead that the default value would be first resolved and then the same value be written to both tables. Here an example (as you probably guess, I'm trying to implement specialization/generalization using rules): -- first and third commands

Alignment Rules

偶尔善良 提交于 2019-12-03 21:22:11
I'm having a bit of trouble with a homework problem, and I was wondering if anyone could point me in the right direction. Suppose we are compiling for a machine with 1-byte characters, 2-byte shorts, 4-byte integers, and 8-byte reals, and with alignment rules that require the address of every primitive data element to be an even multiple of the element’s size. Suppose further that the compiler is not permitted to reorder fields. How much space will be consumed by the following array? A : array [0..9] of record s : short; c : char; t : short; d : char; r : real; i : integer; end; Now I

Postgresql - Clean way to insert records if they don't exist, update if they do

天涯浪子 提交于 2019-12-03 21:05:51
问题 Here's my situation. I have a table with a bunch of URLs and crawl dates associated with them. When my program processes a URL, I want to INSERT a new row with a crawl date. If the URL already exists, I want to update the crawl date to the current datetime. With MS SQL or Oracle I'd probably use a MERGE command for this. With mySQL I'd probably use the ON DUPLICATE KEY UPDATE syntax. I could do multiple queries in my program, which may or may not be thread safe. I could write a SQL function

Should I use Drools in this situation?

Deadly 提交于 2019-12-03 17:44:24
问题 I'll use a university's library system to explain my use case. Students register in the library system and provide their profile: gender, age, department, previously completed courses, currently registered courses, books already borrowed, etc. Each book in the library system will define some borrowing rules based on students' profile, for example, a textbook for the computer algorithm can only be borrowed by students currently registered with that class; another textbook may only be borrowed

What is the new accepted way of programmatically creating new drools rules in Drools 6?

妖精的绣舞 提交于 2019-12-03 17:26:32
问题 In short I want to create, edit and delete rules from a rules repository at runtime. I'm having trouble figuring out how to do this in drools 6+. I know in a previous version of drools (<= 5.6), that there was an XML representation of a .drl file and an API for working with it: https://docs.jboss.org/drools/release/5.6.0.Final/drools-expert-docs/html/ch04.html#d0e8052. The drools documentation as of 5.6 indicates this deprecated and it appears to be completely removed at 6. I don't want to

Drools - rule hierarchy and conditional execution

吃可爱长大的小学妹 提交于 2019-12-03 13:38:09
问题 I was wondering if there is a way to define hierarchy (not just order of execution) between rules and control the rule execution - i.e. if the parent rule fired then the ones below should not be evaluated etc... Information in this thread is an option but it is essentially IF/THEN/ELSE Is there a different option? thanks 回答1: I am not sure if I understand your question, but using a combination of Activation Groups and the traditional conflict resolution strategies might achieve what you need.

What are the valid characters for a Java method name?

ε祈祈猫儿з 提交于 2019-12-03 13:11:24
I read about the naming of Java variables . It says that Java variables cannot start with any numbers and special characters except for $ and _. Some valid examples: int count; int _count; int $count; And some invalid examples: int %count; int 4count; int #count; Do the same rules apply to method names? Yes, method names and variable names are what's called "identifiers". Identifiers all share the same rules regarding accepted characters. Take a look at §3.8 from the Java Language Specification to find out exactly what an identifier may contain, and §6.2 for an explanation about how

Can't import PMD Ruleset in Eclipse

房东的猫 提交于 2019-12-03 12:33:02
I would like to use the same Ruleset in my IDE (Eclipse) that my Sonar profile. I got the PMD XML ruleset from the Sonar Permalinks and would like to import it into my PMD Eclipse Plugin but when i try to do it, the "OK" button is desactivated ... Can someone help me ? The problem could be that Sonar is exporting your ruleset for v4.x format and your Eclipse plugin expects them in v5.x format. Try changing your rules from: <rule ref="rulesets/basic.xml/UnusedNullCheckInEquals"> <priority>3</priority> </rule> to <rule ref="rulesets/java/basic.xml/UnusedNullCheckInEquals"> <priority>3</priority>

ceph crush 策略配置

微笑、不失礼 提交于 2019-12-03 10:59:03
0.问题 一个同事搭建了两个主机的集群。ceph -s 后,集群一直会出现 recovery 32402/195672 objects degraded objects degraded 警告。 原因在于,默认3份副本。crush select策略是从host 选择3副本。所以需要修改crush rules. 1. 获取crushmap二进制文件 # ceph osd getcrushmap -o a.map 2.将二进制文件转成文本文件 # crushtool -d a.map -o b 3.修改rules # vi b rule replicated_ruleset { ruleset 0 type replicated min_size 1 max_size 10 step take default step chooseleaf firstn 0 type osd ### step emit } 4.将文本文件转成二进制文件 # crushtool -c b -o b.map 5.设置crushmap # ceph osd setcrushmap -i b.map 来源: oschina 链接: https://my.oschina.net/u/2407124/blog/497413