Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHu9N-00AhQK-O1 for pgsql-general@arkaria.postgresql.org; Mon, 02 Dec 2024 00:18:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tHu9L-00CGmT-7z for pgsql-general@arkaria.postgresql.org; Mon, 02 Dec 2024 00:18:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHu9K-00CGmK-Or for pgsql-general@lists.postgresql.org; Mon, 02 Dec 2024 00:18:52 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tHu9I-000ZAF-Fi for pgsql-general@postgresql.org; Mon, 02 Dec 2024 00:18:51 +0000 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-71d4182b2cbso1395096a34.2 for ; Sun, 01 Dec 2024 16:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733098727; x=1733703527; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3SGHLdbPKdrjMtbKlj1nkcgab/iQVVgxDzpletjIaBg=; b=MO5cqrwDfCl9ffz16594totCOULiEgZXeJJyGoviPbiaUycEWg80x5DUF/0uImHCN2 7TL54HwS6zNYwrbrUn/5yrn+nENFOWWqmlWxgMwMqVoZcMYD/ohFBJjwpyWS6Vsq1kvf cxu/Ji7UogCLz6nTHcRKsPbYqd6HXo8i5uNtFfBLgmm3BjU0eO0+df+UaRRD+/rM/ZT2 Twn6kU9wnIEZcByVaac/cuwpy5wFfVNQzNMOUUFB6ZT+s5CAXLOeWjaGP/Io0RWOIbmD 2b+MBRmZEGqkxWXVqLUtRm8fybhgh6Kxm9hAbiOst72YiBZ+wYIWnqcQUCxM7mV+gFcf MckQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733098727; x=1733703527; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3SGHLdbPKdrjMtbKlj1nkcgab/iQVVgxDzpletjIaBg=; b=B0TKS+tKuhHjgZ3tLeKlUjaB3pT3DWNvoJRTkCJDo1kkHkstGWne0Wgf/g7Mmxd8Rz TCSboQ3SezmKnDiYgbkgCB7GjHjCGWM0Yud1mT2UEhz5epyj/hlaFvakZuPTOU3R2zV7 cgByMj7sKSJvV5gXXh7O7yYPVz2yWKpATVJLyCxzVQv3m3xxAMjZkp4KssoZkE7NEdjG 0hzFtoAiPtPpbS0qm79+jaWDgDJsILycmO0bF9tlJUE8yTx/WR4udYnkIGAwwF8xHXy1 wXbU+cFpsKDxr8liKzk6WE4nOFyrPcK3RWbgvNRScFl75IPEwvGIb14y8t/7LvlOlotk 5bug== X-Gm-Message-State: AOJu0YyKBTLCkTpMPZFHYhS6QjlXvWMH1t/O9VL1SnfHT4mXifOSKn1m Pas6QLXfM9ktmSugbXrYX41ZDA8yIW6wY4s4mKXrxc8ImsdMYDLmm7SOs59cdGvikm/eAnLKJEf nLlyu0r/m/c4ebDrNNaR6rQ1RFYzlIw== X-Gm-Gg: ASbGncvoBZN5/TvVhsR836bMMJXUElGO0RnzMbnqRzqelPpdJoJBJrAWRHO4hujux4R TvdBClFiS9T41HFbZ3ZwqmzTl9VykmAzN3x9i6QnC98ajkAsOoRPETNxeuVq/yPiIbA== X-Google-Smtp-Source: AGHT+IEWFJniygTNaRUBws/il65lmENlrCovCCYvG7Ooirq+Qa97PGUFo3mTzY+2nRpZfQkJOg/pZUxWRYPQ4tZnL/Q= X-Received: by 2002:a9d:6e8a:0:b0:71d:88f0:b12 with SMTP id 46e09a7af769-71d88f02053mr3498204a34.24.1733098726900; Sun, 01 Dec 2024 16:18:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Sun, 1 Dec 2024 19:18:36 -0500 Message-ID: Subject: Re: Help with syntax error To: PostGreSQL MailingList Content-Type: multipart/alternative; boundary="000000000000fa495206283e7dc2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fa495206283e7dc2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Dec 1, 2024 at 7:14=E2=80=AFPM Arbol One wrot= e: > I have these tables: > > > > > > > > > > > > > > > > > > > > *CREATE TABLE IF NOT EXISTS registrar ( index SERIAL, registrar_id TEXT, > day TEXT NOT NULL, month TEXT NOT NULL, year TEXT NOT NULL, hour TEXT NOT > NULL, minute TEXT NOT NULL, second TEXT NOT NULL, millisecond TEXT NOT > NULL, am_pm TEXT NOT NULL, admin BOOLEAN NOT NULL DEFAULT false, CONSTRAI= NT > key PRIMARY KEY (registrar_id) ); CREATE TABLE IF NOT EXISTS user_name ( > user_name_id TEXT PRIMARY KEY REFERENCES registrar(registrar_id), > first_name TEXT NOT NULL, middle_name TEXT NOT NULL, last_name TEXT NOT > NULL);* > > When I enter the following pg commands : > > > *INSERT INTO registrar VALUES (DEFAULT, '18551420601012L23', '1', '12', > '2024', '18', '55', '14', '207', 'PM'); INSERT INTO user_name > '18551420601012L23', 'John', 'Fitzgerald', 'Kennedy'); <=3D * > *UserNameTable.write()* > > I get this message : > > > > > *Exception in thread "main" java.sql.SQLException: In > company.contact.Company$UserNameTable.write() ERROR: syntax error at or > near "'18551420601012L23'" Position: 23 * > > The error is in the user_name_id, which is a primary that references the > table "*registrar*" 's "*registrar_id" *primary key. > According to the documentation > , the insertion > should be OK, no? > > What am I doing wrong? > What happens when you run those INSERT commands directly in psql? Hint: it's probably going to complain about a syntax error in the second INSERT statement. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000fa495206283e7dc2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Dec 1, 2024 at 7:14=E2=80=AFPM Ar= bol One <ArbolOne@hotmail.ca&= gt; wrote:
=20

I have these tables:

CREATE TABLE IF NOT EXISTS registrar (
index SERIAL,
registrar_id TEXT,
day TEXT NOT NULL,
month TEXT NOT NULL,
year TEXT NOT NULL,
hour TEXT NOT NULL,
minute TEXT NOT NULL,
second TEXT NOT NULL,
millisecond TEXT NOT NULL,
am_pm TEXT NOT NULL,
admin BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT key PRIMARY KEY (registrar_id) );

CREATE TABLE IF NOT EXISTS user_name (
user_name_id TEXT PRIMARY KEY REFERENCES registrar(registrar_id),
first_name TEXT NOT NULL,
middle_name TEXT NOT NULL,
last_name TEXT NOT NULL);

When I enter the following pg commands :

INSERT INTO registrar VALUES (DEFAULT, '18551420601012L23', '1= 9;, '12', '2024', '18', '55', '14', '20= 7', 'PM');
INSERT INTO user_name '18551420601012L23', 'John'= , 'Fitzgerald', 'Kennedy'); <=3D
UserNameTable.write()=

I get this message :

Exception in thread "main" java.sql.SQLException: In company.contact.Company$UserNameTable.write()
ERROR: syntax error at or near "'18551420601012L23'= ;"
=C2=A0 Position: 23

The error is in the user_name_id, which is a primary that references the table "registrar" 's "= registrar_id" primary key.
According to the documentation, the insertion should be OK, no?

What am I doing wrong?


What h= appens when you run those INSERT commands directly in psql?

<= /div>
Hint: it's probably going to complain about a syntax error in= the second INSERT statement.

--
Death to <Redacted>, and butter sauce.
Don't boi= l me, I'm still alive.
<Redacted> lobster!
--000000000000fa495206283e7dc2--