DROP FUNCTION insert_tetel_raktar();

CREATE OR REPLACE FUNCTION insert_tetel_raktar()
  RETURNS void AS
'INSERT INTO tetel_raktar
   (Tetel_kod, Raktar_kod)
Select tetel.kod, raktar_nevek.kod
  FROM tetel CROSS JOIN raktar_nevek
  left outer
  join tetel_raktar
  on (tetel.kod = tetel_raktar.Tetel_kod) and
     (raktar_nevek.kod = tetel_raktar.Raktar_kod)
  where tetel_raktar.Tetel_kod is null'
  LANGUAGE 'sql' VOLATILE;

ALTER TABLE _setup_main ALTER COLUMN profromaszamla_peldanyszam SET DEFAULT 1;
ALTER TABLE _setup_main ALTER COLUMN penztarbiz_peldanyszam SET DEFAULT 1;
ALTER TABLE _setup_main ALTER COLUMN penztarbiz_kezeles_azonnaliszamla_eseten SET DEFAULT 1;

ALTER TABLE _setup ADD COLUMN partnerkereses_szuressel smallint;
ALTER TABLE _setup ALTER COLUMN partnerkereses_szuressel SET STORAGE PLAIN;
ALTER TABLE _setup ALTER COLUMN partnerkereses_szuressel SET DEFAULT 0;

UPDATE _setup SET partnerkereses_szuressel = 0;

ALTER TABLE _setup ALTER COLUMN szallito_kiallitomezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN szallito_mozgasnemmezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN szamla_kiallitomezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN szamla_mozgasnemmezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN bizatadas_kiallitomezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN bizatadas_mozgasnemmezo_modosithato SET DEFAULT 0;
ALTER TABLE _setup ALTER COLUMN raktarbiz_kiallitomezo_modosithato SET DEFAULT 0;

