Alsoo wir sollen folgenden DFA modellieren:

Dieser soll überprüfen ob eine Binärzahl durch 3 teilbar ist
 Ich habe bis jetzt schon recht viel, aber ich verstehe die Fehlermeldung nicht ganz 
 
Das ist die Fehlermeldung:
	
	
	
	
	
		
	
Das ist mein bisheriger Code:
	
	
	
	
	
		
	
			
			
Dieser soll überprüfen ob eine Binärzahl durch 3 teilbar ist
Das ist die Fehlermeldung:
		Code:
	
	Fehler in der SQL-Abfrage (7): ERROR: recursive query "dfa" column 2 has type text in non-recursive term but type character varying overall
LINE 3: inputs.str, 'S0', inputs.str
HINT: Cast the output of the non-recursive term to the correct type.
	Das ist mein bisheriger Code:
		SQL:
	
	CREATE TABLE rules (current_state VARCHAR(2), chr VARCHAR(2), next_state VARCHAR(2));
INSERT INTO rules VALUES
  ('S0', '0', 'S0'), ('S0', '1', 'S1'),
  ('S1', '0', 'S2'), ('S1', '1', 'S0'),
  ('S2', '0', 'S1'), ('S2', '1', 'S2');
CREATE TABLE accept_states (current_state VARCHAR(2), accepted BOOLEAN);
INSERT INTO accept_states VALUES ('S0', true), ('S1', false), ('S2', false);
CREATE TABLE inputs (str TEXT);
INSERT INTO inputs VALUES ('10010'), ('010010010'), ('011');
WITH RECURSIVE dfa(source, current_state, work) AS (
  SELECT
    inputs.str, 'S0', inputs.str
  FROM
    inputs
  UNION ALL
  SELECT
    source,
    next_rules.next_state,
    SUBSTR(dfa.work, 2, 10)
  FROM
    dfa JOIN (SELECT * FROM rules) AS next_rules ON dfa.current_state = next_rules.current_state
  WHERE
    chr = SUBSTR(dfa.work, 1, 1)
)
SELECT
  source,
  accepted
FROM
  dfa JOIN accept_states ON dfa.current_state = accept_states.current_state
WHERE
  work = '';
DROP TABLE rules;
DROP TABLE accept_states;
DROP TABLE inputs;