pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James B. Byrne <byrnejb@harte-lyne.ca>
To: pgsql-general@lists.postgresql.org
Subject: Need another set of eyes on this
Date: Mon, 25 Jan 2021 14:17:42 -0500
Message-ID: <beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca> (raw)

I am recreating a test database with data provided for a series of future
exercises.  Presently I am trying to understand why a simple insert statement
is not working.  The user invoking this insert is 'postgres' and has superuser
privileges.

The error is this:

postgres : STATEMENT:  INSERT INTO public.stock(
		stock_num, manu_code, description, unit_price, unit, unit_descr)
		VALUES (3, "SHM", "aluminum Bat", 180.00, "case", "12/case");
postgres : ERROR:  42703: column "SHM" does not exist at character 105
postgres : LOCATION:  errorMissingColumn, parse_relation.c:3194
postgres : STATEMENT:  INSERT INTO public.stock(
		stock_num, manu_code, description, unit_price, unit, unit_descr)
		VALUES (3, "SHM", "aluminum bat", 180.00, "case", "12/case");

The create script for this table is this:


-- Table: public.stock

-- DROP TABLE public.stock;

CREATE TABLE public.stock
(
    stock_num smallint NOT NULL,
    manu_code character(3) COLLATE pg_catalog."default",
    description character(20) COLLATE pg_catalog."default",
    unit_price money,
    unit character(4) COLLATE pg_catalog."default",
    unit_descr character(15) COLLATE pg_catalog."default"
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.stock
    OWNER to hll_4gl_testing;

COMMENT ON TABLE public.stock
    IS 'The stock table is a catalog of the items sold by the distributor.';

COMMENT ON COLUMN public.stock.stock_num
    IS 'Stock number that identifies type of item';

COMMENT ON COLUMN public.stock.manu_code
    IS 'Manufacturer code (foreign key to manufact table)';

COMMENT ON COLUMN public.stock.description
    IS 'Description of item';

COMMENT ON COLUMN public.stock.unit_price
    IS 'Price per item';

COMMENT ON COLUMN public.stock.unit
    IS 'Unit by which item is ordered:
    Each
    Pair
    Case
    Box';

COMMENT ON COLUMN public.stock.unit_descr
    IS 'Description of unit';
-- Index: stock_manu_code_idx

-- DROP INDEX public.stock_manu_code_idx;

CREATE INDEX stock_manu_code_idx
    ON public.stock USING btree
    (manu_code COLLATE pg_catalog."default" ASC NULLS LAST)
    TABLESPACE pg_default;
-- Index: stock_stock_num_idx

-- DROP INDEX public.stock_stock_num_idx;

CREATE INDEX stock_stock_num_idx
    ON public.stock USING btree
    (stock_num ASC NULLS LAST)
    TABLESPACE pg_default;

COMMENT ON INDEX public.stock_stock_num_idx
    IS 'Index for stock numbers. Numbers may be duplicated by different
manufacturers.';
-- Index: stock_stock_num_manu_code_idx

-- DROP INDEX public.stock_stock_num_manu_code_idx;

CREATE UNIQUE INDEX stock_stock_num_manu_code_idx
    ON public.stock USING btree
    (stock_num ASC NULLS

There will be a foreign key constraint on manu_code to manufact.manu_code but
that is not yet implemented.

The reference to column "SHM" not existing has me confused.  I am probably
missing something obvious but I cannot see what the problem is.  Any help would
be most welcome.

Thanks,

-- 
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
   Unencrypted messages have no legal claim to privacy
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3






view thread (4+ messages)  latest in thread

Message-ID: <beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca>
Permalink:  ../beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca/
Also on:    postgresql.org/message-id/beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: byrnejb@harte-lyne.ca
  Subject: Re: Need another set of eyes on this
  In-Reply-To: <beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca>
  References: <beea3a62f7eacc3f7f69af8842832e8c.squirrel@webmail.harte-lyne.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox