Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4Lhl-0008EJ-10 for pgsql-general@arkaria.postgresql.org; Wed, 31 May 2023 13:17:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q4Lhi-00022m-MQ for pgsql-general@arkaria.postgresql.org; Wed, 31 May 2023 13:17:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4Lhi-00022d-AP for pgsql-general@lists.postgresql.org; Wed, 31 May 2023 13:17:30 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q4Lhf-003I0X-Du for pgsql-general@lists.postgresql.org; Wed, 31 May 2023 13:17:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5JuK7EfOD6MnFUk+dPES599LigIs5mB5/4WKGyWMlTE=; b=SZBPSKMiZd5KK2KsF7U3FSD2ro hapWTaab/DD15Aw9RrSs+umrVWnmscRtD6fR2MQavg/1CDIBGjBWi0qWdMg4Tk80VNcAoa8gmCmQv vRkOkWmuYwOVtz4BfJMSuPI02JXzFwke28QiHjaTxMYzWiSWNw3o4HqbwS0Q2YD7r9oA=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1q4Lhe-00FzMW-HS; Wed, 31 May 2023 15:17:26 +0200 Date: Wed, 31 May 2023 15:17:26 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Wen Yi <896634148@qq.com> Cc: pgsql-general Subject: Re: Is there a bug in psql? (SELECT ''';) Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, May 31, 2023 at 03:17:14PM +0800, Wen Yi wrote: > Hi team, > when I learn the postgres, I try to store the ' into the database, > > but something unexpected happend. > > > postgres=# CREATE TABLE test (str varchar); > CREATE TABLE > postgres=# INSERT INTO test values ('''); > postgres'# SELECT * FROM test; In here, in prompt, you can see that it's waiting for you to end your '-qutoed string. You seem to expect INSERT INTO test values ('''); to do something, which it won't as it's not full query. What do you think this should be doing? Best regards, depesz