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 1t3xYD-00FaZ5-PJ for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 13:06: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 1t3xYB-00346r-D2 for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 13:06:51 +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 1t3xYA-00346j-Vq for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 13:06:51 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t3xY9-002jZ0-1V for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 13:06:50 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2fc96f9c41fso10615291fa.0 for ; Thu, 24 Oct 2024 06:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729775207; x=1730380007; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/Te/aE4Hj9m6ru5i8I5ika4oANqoc8zrUZmc4CHDV2s=; b=JESjilELn8IZTCSHKAoH7TgSYzNTUMYQvIdAHTuV1wrMkM9rlrejN2taVFNXl4J0Qh W0nQ6/P76jPQTcp7M00iL6VNuOvUuUpmhv+DXtKIWtsp655f8VtgTM5a4Q2qBIvLm4MV 5kSDeuiVjOsVWwe9rUNdcECnAWm8soyP/x5VCrJLDfIZUItmS2KsJwIf9pGfwSZ/6DCo hVbjiALXV/TnqcXRuXRTJu8R5dZTjCzwL+TgazQg36JN8v+o4rNPv7/+BJiHX61B5JNa sBC5hHPSZGvgdbaPgKS3Gz5Nqf9+YWUDl1p9LqDntialwkTF8pFgdtSD6iPEctlHTVIC Eiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729775207; x=1730380007; h=cc: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=/Te/aE4Hj9m6ru5i8I5ika4oANqoc8zrUZmc4CHDV2s=; b=clh0eFo2b4D/eqHqKplek55xMWSSAuvnUNDmiKb1q8/nSdYFTYld8yC7p/X7Hfk1ti +dyyxn8/HUXhj+LMOhSTl//7vhoPs7Y9kBoHcxk6Iu52HOcTlZ56hFhoOTxMLZLtIaeX LRWVZ3IQ4Vqn89Zi+WCH9VnHcZ8PbE6gucIjvvKfNHqR4wmFUA8AKStSMEcNrqTFP+Ze QDK5SelNDLyGfCYR1BOQQHwc9H3+H2t0WctIGiwB40VbssCdoMes83b/y/VblxUWNlzD gfKs29O/1xKTvmjB35oO4P41jXKfJVE/jiktM+jE/KU1AHfuoVwfpfrz2qKW+MUaXLPG a58A== X-Forwarded-Encrypted: i=1; AJvYcCXHJeUlCSLMpmrJj0J2/oWcvXOYzFPYueySanIme1kedN+zE5/eb6+m4NKtWFnFRxR+wiPLTUGIXIS3p2s5@lists.postgresql.org X-Gm-Message-State: AOJu0YyIPL/nRM+ipzUaD+VnHWPm10XDOQVW0gwgncmggQZLBdUywoLA RcSZVGstEkN3RiTlxl/xSrN5jFd3LlzwqVhhKDJfqDSgbNwEafBlqiyE9BNueePRzgjb+ov0zEO s3S2qI8aC0oz4FSrWZggEVPKbTsA/cbTn X-Google-Smtp-Source: AGHT+IEKZizi65RuGbTQPJEfLzaJuCTP1Fd5JCsmnOfAESlGt/xWwnfw7GgkAj7d2gm5wnqQ2AMgxSyLHruz1J1OOVI= X-Received: by 2002:a17:907:3d89:b0:a9a:eeb:b26a with SMTP id a640c23a62f3a-a9ad199c380mr207746966b.1.1729774882074; Thu, 24 Oct 2024 06:01:22 -0700 (PDT) MIME-Version: 1.0 References: <00b001db2475$e6584640$b308d2c0$@bry-it.com> <01020192b98778c0-78365d74-1341-45c8-b0de-cc6b962afcf9-000000@eu-west-1.amazonses.com> In-Reply-To: <01020192b98778c0-78365d74-1341-45c8-b0de-cc6b962afcf9-000000@eu-west-1.amazonses.com> From: Muhammad Ikram Date: Thu, 24 Oct 2024 18:01:09 +0500 Message-ID: Subject: Re: CURRENTE_DATE To: "Ray O'Donnell" Cc: Rossana Ocampos , pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000633668062538995e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000633668062538995e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I am just thinking, when DEFAULT CURRENT_DATE is being used in table definition then why the function is again being used in INSERT statement why not use default. Here is sample edb=3D# create table date_test (id int, hiredate date default current_date)= ; CREATE TABLE edb=3D# insert into date_test values (1, *default*); INSERT 0 1 edb=3D# select * from date_test; id | hiredate ----+-------------------- 1 | 24-OCT-24 00:00:00 (1 row) Regards, Ikram On Wed, Oct 23, 2024 at 6:18=E2=80=AFPM Ray O'Donnell wr= ote: > On 22/10/2024 12:31, Rossana Ocampos wrote: > > *Hello ,* > > I am new with PostgreSQL and I have a bug. I have created a function that > has an input variable of type date , in case it does not receive value , = it > has to assume by default the current date. > > I have defined it as follows variable DATE DEFAULT CURRENT_DATE, but I > get the following error. > > > > *El error * > > ERROR: invalid input syntax for type date: =E2=80=9CCURRENT_DATE=E2=80=9D= LINE 1: > ...extsupplydate ('1085018'::bigint, '5278'::bigint, 'CURRENT_D... ^ ERRO= R: > invalid input syntax for type date: =E2=80=9CCURRENT_DATE=E2=80=9D SQL st= atus: 22007 > Characters: 78 > > > I think you just need to leave off the quotes, as current_date is a > function: > > insert into .... values ( ... , current_date, ....); > > Also, you don't need to quote the bigint values. > > > HTH, > > Ray. > > > > > Please could you help me, thank you very much. > > Rossana > > > > -- > Raymond O'Donnell // Galway // Irelandray@rodonnell.ie > > --000000000000633668062538995e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I am just thinking, when DEFAULT CU= RRENT_DATE is being used in table definition then why the function is again= =C2=A0being used in INSERT statement why not use
default. Here is= sample


edb=3D# create table date_test (id int= , hiredate date default current_date);
CREATE TABLE
edb=3D# insert in= to date_test values (1, default);
INSERT 0 1
edb=3D# select * = from date_test;
=C2=A0id | =C2=A0 =C2=A0 =C2=A0hiredate
----+--------= ------------
=C2=A0 1 | 24-OCT-24 00:00:00
(1 row)

=
Regards,
Ikram


On Wed, Oct 23, 202= 4 at 6:18=E2=80=AFPM Ray O'Donnell <ray@rodonnell.ie> wrote:
=20 =20 =20
On 22/10/2024 12:31, Rossana Ocampos wrote:
=20 =20 =20

Hello ,

I am new with PostgreSQ= L and I have a bug. I have created a function that has an input variable of type date , in case it does not receive value , it has to assume by default the current date.=

I have defined it as follows variable =C2=A0DATE DEFAULT CURRENT_DATE, but I get the following error.

=C2=A0

El error <= u>

ERROR: invalid input syntax for type date: =E2=80=9CCURRENT_DATE=E2=80=9D LINE 1: ...extsupplydate ('1085018'::bigint, '5278'::bi= gint, 'CURRENT_D... ^ ERROR: invalid input syntax for type date: =E2=80=9CCURRENT_DATE=E2=80=9D SQL status: 22007 Characters: 78=


I think you just need to leave off the quotes, as current_date is a function:

=C2=A0 insert into .... values ( ... , current_date, ....);

Also, you don't need to quote the bigint values.


HTH,

Ray.


=C2=A0

Please could you help me, thank you very much.

Rossana <= /span>



--=20
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie<=
/pre>
  
--000000000000633668062538995e--