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 1gfHns-0006Ey-9x for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Jan 2019 05:13:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfHnp-0005Eu-Nk for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Jan 2019 05:13:49 +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 1gfHnp-0005En-Dz for pgsql-hackers@lists.postgresql.org; Fri, 04 Jan 2019 05:13:49 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfHni-0001LT-0f for pgsql-hackers@postgresql.org; Fri, 04 Jan 2019 05:13:49 +0000 Received: by mail-qk1-x744.google.com with SMTP id o125so20958903qkf.3 for ; Thu, 03 Jan 2019 21:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:in-reply-to:cc:message-id:date :user-agent:mime-version:content-transfer-encoding:content-language; bh=/kqZirDcoHwd9xJaiHjpuoosAO9RDag1ijkHNBM/jHs=; b=achT3btCi6iWIF5u5qmxQffYRBAa4RArsNWdh4xj8E1NuCppfQDiIbaDDJVUoRuLRY vOvWHg2Z1ga1qnfBQ9ZkvRSTRAeJNEio+j0tuR6z9iQp7xJG2cOCQextwMtEqEV5HSgi ekyxXWxPQYOQsONljOIlPfIA5yBE3YER5VhB8idfy88kwOG6lCF+DjFH4vD2ktMjS6W8 7s7VK3S5UUzXFTys3tCfJWtOhkpIfe4KqEwmf02zazufl2uHVgz4I4njKd6wG7QX8Oph JS3TBicSFP/U/Yj5n+ViGP7w1PHu6jWFpEhj4dYOo8EKDNUZSMJYtbgS1H3o9wx8OMvV YUMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:in-reply-to:cc :message-id:date:user-agent:mime-version:content-transfer-encoding :content-language; bh=/kqZirDcoHwd9xJaiHjpuoosAO9RDag1ijkHNBM/jHs=; b=g6xdt7SYM6XA0VN/NktM49cOZaiqiX0CQWIltCObtIcgFNAtRxqhSM7ypGXMEyuGRS 2tycg1hRiKp33vKjBNaqseCq4xfLK5REihmM7IEWxkEW5io5rh2/DaeswhwJyTU23jBK utEM0QN/+BT72FoNQ+AGsFwO7F2+7wuoTjUwxKP+KDzE7A1SqHOU3uy+0ZjRilDiGvwm uXpvV8jxIEFRXP9q64+EFR2bIHm90eEl+Dpq1Ff5gPsFDtEq0Ik2fzQMAoTzadxJM8fo LQVD8RW7C7RomuUOQ+PIl46V4XrVk7GCHQ8WPYrSwzQ2cMT0nVQ12vkr4gZ69sje2E2W woDg== X-Gm-Message-State: AJcUukdoCvsj7QgVxewhCdBPy2pPip8G1yoQKZY1J6499H+cqi34Rzc2 pFOL5T9KK2vVY+VdsTcCU7Q= X-Google-Smtp-Source: ALg8bN68B2/a56cGpBzkLG6AXiRZ2wF7hNsOzY7HCMlG2akCVp/9CgCQjKm+ERNbwM/9bfC8Ha0gzw== X-Received: by 2002:a37:bf81:: with SMTP id p123mr11245491qkf.125.1546578819705; Thu, 03 Jan 2019 21:13:39 -0800 (PST) Received: from [192.168.2.78] (c-73-201-119-74.hsd1.md.comcast.net. [73.201.119.74]) by smtp.gmail.com with ESMTPSA id r47sm28147203qtc.77.2019.01.03.21.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 21:13:38 -0800 (PST) Subject: Re: SQL/JSON: functions From: Andrew Alsup To: Nikita Glukhov , PostgreSQL-development References: <0c6e3740-7774-2d60-5eaa-c61bb5c1f2e0@gmail.com> In-Reply-To: <0c6e3740-7774-2d60-5eaa-c61bb5c1f2e0@gmail.com> Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Pavel Stehule , Oleg Bartunov , Alexander Korotkov Message-ID: <8b75b660-9ea3-adbe-951c-2aa3a5f1801f@gmail.com> Date: Fri, 4 Jan 2019 00:13:37 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > Attached patches implementing all SQL/JSON functions excluding JSON_TABLE: > > JSON_OBJECT() > JSON_OBJECTAGG() > JSON_ARRAY() > JSON_ARRAYAGG() > > JSON_EXISTS() > JSON_VALUE() > JSON_QUERY() Sorry if this is a stupid question, but is this patch intended to implement any SQL/JSON functions? I'm basing this question on the original patch post (quoted above). The patch appears to be focused exclusively on "jsonpath expressions". I only ask because I think I misinterpreted and spent some time wondering if I had missed a patch file. So far, the jsonpath docs are very readable; however, I think a few complete examples (full SELECT statements) of using jsonpath expressions would be helpful to someone new to this technology. Does postgresql provide a sample schema, similar to the Or*cle scott/tiger (emp/dept) schema, we could use for examples? Alternatively, we could reference something mentioned at https://wiki.postgresql.org/wiki/Sample_Databases. I think it would be nice if all the docs referenced the same schema, when possible. For tests, would it be helpful to have some tests that demonstrate/assert equality between "jsonb operators" and "jsonpath expressions"? For example, using the existing regression test data the following should assert equality in operator vs. expression: SELECT   CASE WHEN jop_count = expr_count THEN 'pass' ELSE 'fail' END FROM   (     -- jsonb operator     SELECT count(*)     FROM testjsonb     WHERE j->>'abstract' LIKE 'A%'   ) as jop_count,   (     -- jsonpath expression     SELECT count(*)     FROM testjsonb     WHERE j @? '$.abstract ? (@ starts with "A")'   ) as expr_count;