Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiUUy-0006cg-9z for pgsql-general@arkaria.postgresql.org; Sat, 21 Dec 2019 02:28:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iiUUx-00074v-4X for pgsql-general@arkaria.postgresql.org; Sat, 21 Dec 2019 02:28:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiUUw-00074n-R6 for pgsql-general@lists.postgresql.org; Sat, 21 Dec 2019 02:28:06 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iiUUu-00073F-OI for pgsql-general@lists.postgresql.org; Sat, 21 Dec 2019 02:28:06 +0000 Received: by mail-ot1-x32a.google.com with SMTP id w21so6521490otj.7 for ; Fri, 20 Dec 2019 18:28:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=cj96zq9P2tc0BcNBu6/0wS6YH2lhl4OU/KKbovWa02g=; b=iuwBpPmcOOzq/lrVDDRyRn7AmTuapHQSq2WXSlV7wEb/NoYpsrguydqsZ7DkLAHsRp yMUNXpzOuYMzsoYBu6nBHht+CKRwEJXnrkpXD2v1cfDvZfVTxZnSlAU21oUmxHGkmx4w Ltjc/IC8gpOBAFLfAVzO+ffvPVcMsDty8RIj3Weslyq2RIeLTLuPV91eFP2lyTxgCDb1 2AvqASp8w3aHiBiWEtHFTzzBCLXPshWQfm2DIneyMFBc7pQ9smEm0XL1SfFL3GNgsRb8 idQtT6E0QvO2hYLc6cAkDsA7Rjc71Xht6XNMvLAYPLZGVnnzBcs+cfD8A0FTa1jQ12te liBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=cj96zq9P2tc0BcNBu6/0wS6YH2lhl4OU/KKbovWa02g=; b=Na2BH5HREyXBJd62VLOcdQ7hhdlttgqkGjQVWRfinjL1J+Wv2X7EN7N3OPWLZ2aaEC 7Wgm0F/pc/rCPrNNV9Q2y7Aq6gB8kULVN/HuiYrHK7d8BWQgXNCU5f5i+IDbll0i/dp9 2uR4VbLFB5B5iDUuQ1wAVpukZvRxRfw+Q/4Tb7Uy/c9QopMQzJpSb2iR+79dwybaQJga aRZXZVUzg1ewE8TJhIfWzOnLjcU8FOVuKNM2o/dStJvCUVhcq1HRDxI5n3+kwvk0LzfA oUyedCK4Vx0pesJzz20XNjAM8j3vAYoXhSrbkn9psSAx0iI78BnBp/BYDQRZG2R2cDRA lOLA== X-Gm-Message-State: APjAAAVOglPAhHb7X120R9xkl75fuZGYtLVdefl+4N7+ZbPN8RDz7zer NopaitUZyJ3XMAUPfdCbfNHWIEx8poY= X-Google-Smtp-Source: APXvYqzNKk2mbXnOeNVtyl4XfgTqoKp8tKCEO/dP+PY7qCB2vQ/UPmzrKca+9B+/Qb6vO6C0EAOUlg== X-Received: by 2002:a05:6830:1691:: with SMTP id k17mr19095580otr.282.1576895282858; Fri, 20 Dec 2019 18:28:02 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id s26sm4145070otk.43.2019.12.20.18.28.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 18:28:02 -0800 (PST) Subject: Re: Semi-unable to add new records to table--primary key needed? To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <9c113278-3593-92dc-fbe5-7e3e0018218a@gmail.com> Date: Fri, 20 Dec 2019 20:28:01 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------732DBDEE4EB7C5B082288504" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------732DBDEE4EB7C5B082288504 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 12/20/19 8:19 PM, Boylan, Ross wrote: > I have a table that seems to act for some purposes as if I can't add new records to it. I would like to understand why that is and fix it. > > The initial problem was that an MS-Access application using an ODBC driver (driver and database 64 bit PG 12.0) failed at > DoCmd.GoToRecord , , acNewRec > which is basically saying to create a new record in the table. The error was something like unable to create record. Unfortunately DoCmd is a black box; I can only speculate what it is doing. > > If I open the table in Access's default grid view, the controls to add records are likewise greyed out. > And if I open the table in pgAdmin, it likewise will not let me create a new record. So the problem is not Access-specific. Might it be a privilege problem? > With other, similar tables, I can add new records. > > And even with tblaliquot, I can add new records with sql; that's how I populated the table. Perhaps the problem is that I specified values for fields that are serial, and the counter still seems to be at 1. > > The table also has lots of records relative to most other ones. It has about 72,000 records. > > The only obvious difference between the tables is that the others had primary keys, and this one doesn't. Could that explain what was going on? The lack of PK should make insertions *more* forgiving.  (It really should have a PK, but that's irrelevant to this problem.) > I had to abandon plans to rollout a conversion to Postgres because of this problem, and so I'd like to solve it so we can do the switch relatively soon. > > Here's the SQL on the table from pgAdmin: > CREATE TABLE public.tblaliquot > ( > aliquotid integer NOT NULL DEFAULT nextval('tblaliquot_aliquotid_seq'::regclass), > preparationid bigint, > datealiquotted date, > rnaaliquottype bigint, > sequencer character varying(4) COLLATE pg_catalog."default", > aliquotlabel character varying(40) COLLATE pg_catalog."default", > aliquotbarcode character varying(255) COLLATE pg_catalog."default", > rnaaliquotconcentration double precision, > originalvolume double precision, > numberdefrosts integer, > storagetype bigint, > locationfreezer bigint, > locationrow character varying(10) COLLATE pg_catalog."default", > locationrack character varying(10) COLLATE pg_catalog."default", > locationbox character varying(10) COLLATE pg_catalog."default", > locationplate character varying(255) COLLATE pg_catalog."default", > locationspace character varying(10) COLLATE pg_catalog."default", > locationother character varying(60) COLLATE pg_catalog."default", > aliquottedby bigint, > comments text COLLATE pg_catalog."default", > creationdate date, > createdby bigint > ) > > The original code that created the table used AliquotID serial for the first field. > > The sequence mentioned in the first field of the definition shows Current Value of 1 in the properties tab in pgAdmin, despite the large number of records. But the sequences associated with other tables also are very low, like 3 or 4. 3 or 4 might be the number of records added after the initial creation. > > This worked from psql: > INSERT INTO tblAliquot VALUES (55338, 6772, '2012-10-05 00:00:00', 6, E'A', NULL, NULL, 24.3, > 33, 0, 1, NULL, NULL, E'1', E'A', NULL, > E'A1', NULL, 23, NULL, '2012-10-18 00:00:00', 55 ); > > -- Angular momentum makes the world go 'round. --------------732DBDEE4EB7C5B082288504 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/20/19 8:19 PM, Boylan, Ross wrote:
I have a table that seems to act for some purposes as if I can't add new records to it.  I would like to understand why that is and fix it.

The initial problem was that an MS-Access application using an ODBC driver (driver and database 64 bit PG 12.0) failed at 
    DoCmd.GoToRecord , , acNewRec
which is basically saying to create a new record in the table.  The error was something like unable to create record.  Unfortunately DoCmd is a black box; I can only speculate what it is doing.

If I open the table in Access's default grid view, the controls to add records are likewise greyed out.
And if I open the table in pgAdmin, it likewise will not let me create a new record.  So the problem is not Access-specific.

Might it be a privilege problem?

With other, similar tables, I can add new records.

And even with tblaliquot, I can add new records with sql; that's how I populated the table.  Perhaps the problem is that I specified values for fields that are serial, and the counter still seems to be at 1.

The table also has lots of records relative to most other ones.  It has about 72,000 records.

The only obvious difference between the tables is that the others had primary keys, and this one doesn't.  Could that explain what was going on?

The lack of PK should make insertions more forgiving.  (It really should have a PK, but that's irrelevant to this problem.)

I had to abandon plans to rollout a conversion to Postgres because of this problem, and so I'd like to solve it so we can do the switch relatively soon.  

Here's the SQL on the table from pgAdmin:
CREATE TABLE public.tblaliquot
(
    aliquotid integer NOT NULL DEFAULT nextval('tblaliquot_aliquotid_seq'::regclass),
    preparationid bigint,
    datealiquotted date,
    rnaaliquottype bigint,
    sequencer character varying(4) COLLATE pg_catalog."default",
    aliquotlabel character varying(40) COLLATE pg_catalog."default",
    aliquotbarcode character varying(255) COLLATE pg_catalog."default",
    rnaaliquotconcentration double precision,
    originalvolume double precision,
    numberdefrosts integer,
    storagetype bigint,
    locationfreezer bigint,
    locationrow character varying(10) COLLATE pg_catalog."default",
    locationrack character varying(10) COLLATE pg_catalog."default",
    locationbox character varying(10) COLLATE pg_catalog."default",
    locationplate character varying(255) COLLATE pg_catalog."default",
    locationspace character varying(10) COLLATE pg_catalog."default",
    locationother character varying(60) COLLATE pg_catalog."default",
    aliquottedby bigint,
    comments text COLLATE pg_catalog."default",
    creationdate date,
    createdby bigint
)

The original code that created the table used AliquotID serial for the first field.

The sequence mentioned in the first field of the definition shows Current Value of 1 in the properties tab in pgAdmin, despite the large number of records.  But the sequences associated with other tables also are very low, like 3 or 4.  3 or 4 might be the number of records added after the initial creation.

This worked from psql:
INSERT INTO tblAliquot VALUES (55338, 6772, '2012-10-05 00:00:00', 6, E'A', NULL, NULL, 24.3, 
   33, 0, 1, NULL, NULL, E'1', E'A', NULL, 
   E'A1', NULL, 23, NULL, '2012-10-18 00:00:00', 55 );



--
Angular momentum makes the world go 'round.
--------------732DBDEE4EB7C5B082288504--