[freeside-users] CSV Batch Import Question

Ivan Kohler ivan at sisd.com
Wed Aug 1 17:31:51 PDT 2007


On Thu, Jul 19, 2007 at 04:46:45PM -0600, Chris Sterling wrote:
> Hey folks. I'm running FS 1.7.2 on Debian Etch 64bit with HTML:Mason and 
> Postgres, etc etc, and it's working great.
> 
> Question is, does agent_custid have to be unique?

Yes, absolutely.  It needs to be unique (per agentnum), or left empty 
(set to NULL).

This field is used to store the agent's (reseller's) local idea of the 
customer number.

> I see a patch to make it not unique, but it's for an older version of 
> FS 
> (http://www.sisd.com/pipermail/freeside-commits/2006-October/002417.html).

I believe you are reading this patch incorrectly.  The patch makes sure 
that inserting *empty* values into NULLable colums, such as 
agent_custid, inserts NULLS and not the empty string.  It does *not* 
"make agent_custid not unique".

> The error I get is "*ERROR: duplicate key violates unique constraint 
> "cust_main1".
> 
> Any suggestions?

Leave agent_custid completely blank, or set it to a unique value.

You might want to run 
  UPDATE cust_main set agent_custid = NULL where agent_custid = '';

if you have empty, non-null values in there somehow (the upgrade 
script will take care of this automatically in future releases).

-- 
_ivan


More information about the freeside-users mailing list