Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Improved query for showing all new 'public.address_base' records added to the EAS.

...

  1. Find the change_request_id of the most recent bulk load.

    Code Block
    languagesql
    -- Get the change_request_id of the most recent bulk load:
    SELECT change_request_id
    FROM public.change_requests
    WHERE requestor_comment LIKE 'bulk load change request'
    ORDER BY change_request_id DESC
    LIMIT 1;
    
    -- Make note of this id for the queries in the subsequent steps.


  2. Count and view new base addresses associated with the change request.

    Code Block
    languagesql
    -- Count new base addresses
    SELECT COUNT (*)
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here
    AND unit_num IS NULL;
    
    -- View new base addresses
    SELECT *
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here
    AND unit_num IS NULL;


  3. Count and view new unit addresses associated with the change request.

    Code Block
    languagesql
    --- Count new unit addresses
    SELECT COUNT (*)
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here
    AND NOT unit_num IS NULL;
    
    -- View new unit addresses
    SELECT *
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here
    AND NOT unit_num IS NULL;


  4. Count and view all new 'public.addresses' records associated with the change request.

    Code Block
    languagesql
    -- Count all new addresses
    SELECT COUNT (*)
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here;
    
    -- View all new addresses
    SELECT *
    FROM public.addresses
    WHERE activate_change_request_id = change_request_id_goes_here;


  5. Count/view view new 'public.address_base records associated with any new public.addresses ' records added to the EAS.

    Code Block
    languagesql
    -- Count/view new 'public.address_base' records associated
    with any new public.addresses records added to the EAS
    
    SELECT COUNT(*) FROM public.address_base, public.addresses
    WHERE public.address_base.address_base_id = public.addresses.address_base_id
    AND public.addresses.activateaddress_changebase_request_idflg = change_request_id_goes_here;
    
    SELECT TRUE
    AND public.addresses.activate_change_request_id, address_id, public.address_base.address_base_id, base_address_prefix, base_address_num, base_address_suffix, public.address_base.create_tms, = change_request_id_goes_here;
    
    -- View new 'public.address_base.retire_tms, zone_id, street_segment' records
    SELECT activate_change_request_id, distance_to_segment, geometryaddress_id, public.address_base.last_change_tms*
    FROM public.address_base, public.addresses
    WHERE public.address_base.address_base_id = public.addresses.address_base_id
    AND public.addresses.address_base_flg = TRUE
    AND public.addresses.activate_change_request_id = change_request_id_goes_here;


  6. Optional: count all records in the database for use in a before/after record count comparison.

    Code Block
    languagesql
    SELECT schemaname,relname,n_live_tup FROM pg_stat_user_tables ORDER BY schemaname,relname,n_live_tup;


...