Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case when(--for example 8=8
- /*8=*/ (select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole') =(
- /*=8*/ ((
- (select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole')
- UNION(select count(*) from voto where new.data=voto.data and
- voto_palese='contrario') UNION
- (select count(*) from voto where new.data=voto.data and
- voto_palese='astenuto'))/2)+1) and
- (select count(*) from voto where new.data=voto.data
- and(voto.ddl=new.ddl or voto.mozione=new.mozione))
- )
- then new.esito='approvato'
- else new.esito='non approvato'
- end, --esito,
- ERRORE: l'argomento di AND deve essere di tipo booleano, non bigint
- LINE 34: (select count(*) from voto where new.data=voto.dat...
- ^
- QUERY: insert into public.votazione(
- mozione,
- ddl,
- codice,
- favorevoli,
- votanti,
- contrari,
- astenuti,
- esito,
- tipo_assemblea,
- seduta_numero,
- data,
- assenti,
- missione)
- values((select codice from mozione where codice=new.mozione and
- mozione.data=new.data),--mozione,
- (select titolo from ddl where titolo=new.ddl), --ddl,
- (select codice from ddl where new.ddl=ddl.titolo), --codice,
- (select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole'), --favorevoli,
- ((select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole')
- UNION(select count(*) from voto where new.data=voto.data and
- voto_palese='contrario') UNION
- (select count(*) from voto where new.data=voto.data and
- voto_palese='astenuto')), --votanti,
- (select voto_palese from voto where data=new.data and
- voto_palese='contrario'), --contrari,
- (select voto_palese from voto where data=new.data and
- voto_palese='astenuto'), -- astenuti,
- case when(--for example 8=8
- /*8=*/ (select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole') =(
- /*=8*/ ((
- (select count(*) from voto where new.data=voto.data and
- voto_palese='favorevole')
- UNION(select count(*) from voto where new.data=voto.data and
- voto_palese='contrario') UNION
- (select count(*) from voto where new.data=voto.data and
- voto_palese='astenuto'))/2)+1) and
- (select count(*) from voto where new.data=voto.data
- and(voto.ddl=new.ddl or voto.mozione=new.mozione))
- )
- then new.esito='approvato'
- else new.esito='non approvato'
- end, --esito,
- (select tipo_assemblea from ordine_del_giorno_ass_cam_e_sen where
- data=voto.data), --tipo_assemblea,
- (select seduta_numero from ordine_del_giorno_ass_cam_e_sen where
- data=voto.data), --seduta_numero,
- (SELECT data from ordine_del_giorno_ass_cam_e_sen where
- new.tipo_assemblea=ordine_del_giorno_ass_cam_e_sen.tipo_assemblea and
- ordine_del_giorno_ass_cam_e_sen.data=voto.data), --data,
- (select count(*) from timbratura_giornaliera where presenze='Assente' and
- new.data=timbratura_giornaliera.data), --assenti,
- (select count(*) from timbratura_giornaliera where presenze='In missione'
- and new.data=timbratura_giornaliera.data) -- missione
- )
- CONTEXT: funzione PL/pgSQL inserimento_votazione() riga 4 a istruzione SQL
- ********** Error **********
- ERRORE: l'argomento di AND deve essere di tipo booleano, non bigint
- SQL state: 42804
- Context: funzione PL/pgSQL inserimento_votazione() riga 4 a istruzione SQL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement