Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123378 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 1EB981A009C for ; Tue, 21 May 2024 05:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716270893; bh=e/Z8F4SHYtko2meoChBEP3lF9c0bClFc66mgXW3TEF0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ABQXgKyyOJDSoVrym/X4WvKQdOT94nJHvvWA83oCFaYTy5Ek+cZBikEgQBAIhl56r /Cx3Is9/HBa2b2FUYi91HE32LC2iFTDkCxl9rvx1IuRPbJ5bKH/vHu3/STfH3CpFsC 1gV/MDGzBAEHeBlas9NaRiEinnc0aH8hGX5XUDZBjVgc12jcl8ppBlIKVXpi+0G+vY 6HKoEWJMG9rI8KKmUUv5+G73Hcs2G5aqvxUP99/4VoWOzOG2SC9/lJTqZ/vtQ9Fi0R 0Lw0lbwPmvDWD8YUvFhgvbDSBpD/odVNGz8lyBicJzzj5n4a8qcWWbpu1ENPWzDhQw 3+ZUoAzx1Zkfw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5E589180041 for ; Tue, 21 May 2024 05:54:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 21 May 2024 05:54:51 +0000 (UTC) Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-792e4c2a002so321981385a.0 for ; Mon, 20 May 2024 22:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716270836; x=1716875636; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=e/Z8F4SHYtko2meoChBEP3lF9c0bClFc66mgXW3TEF0=; b=Qi4Fm8JQZ1zAh86qzcgC5QP4L4IxYKMzNO/bobcjSp19NSiTrjKSzdYkFuy5cUpmOp mOF9WPJt2i6x0uvBZkvtiU0EuXFCFmK/D5ocsLLVhucfp+TEefqBxN+1/MfwpiiXfdy9 6ceQquA8+1qbAlXPuP8db3lfPb2gI+RR5kTi4r7S3Mzd+whuXoTIMvt0DUjXqnvp3TTa G0Qa9uK45Wehhaq56NZRm/1wrqT7bgz9RYi5jbjGly/BpmOh/zLe8oovl/oHgvr56cBc r1Ettgp83LZfn+tKVBoUHikGkcuhYkmgUh3YrekTKkJFanUHdrm4fHQ9dVLjsKxQ2KIv S7ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716270836; x=1716875636; 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=e/Z8F4SHYtko2meoChBEP3lF9c0bClFc66mgXW3TEF0=; b=IEexPeBdwpBT5+gAt8SwCEbHhiFDy6LUPrwyKKvuAWZSWVAthOUBLmAxXqQ2y7iX8a bLRI7qyUVhOjAgjaNPm31dXNnWBtlA3Mo5bMWKfKzGZ9SP4N9lZSonB5Y9zOvPE9s3zz Q+jr4yMPtfETs/BhWi1G+avIdeBdM3n/sybsj0slaskVYg4rwfdjYOKkXNEn741i3ez7 f3qubVibJNDYrw0v7sr2l0vKlhr6VuEQPWNdwxmJ6tYNLPUedvozoRBTZ4Yh0/LD0WeX /ls0A/Axg9ntlUrJNMLbMB2oxdfcpspkKwEeD6pCjhk4oLgrX1BqZF5bijInSZlitewJ 3FqA== X-Gm-Message-State: AOJu0YzD7EnyPrprKjtxz6s7H2XCFZ2yq1rsBDlJ5M5Jbqd765V4QdDJ 5AUd3rbKJf77YPWEG6N9Rkn6iWzCeibprnm2w18WVuoMyZuTq41Zay+5umErWSI1u+p/OjdWwA+ KkABuQokHljNtG1AWWv2Qa77M3HV7nw== X-Google-Smtp-Source: AGHT+IE3wIZFmNIihsaZtMUwmZe3jwJuoTazul66awJmDPNVLdu00TBD4yMopVWZ5rRrsIZEM7exNw1vYlPwTzpummA= X-Received: by 2002:a05:6214:33c2:b0:6aa:2697:274b with SMTP id 6a1803df08f44-6aa2697383amr63934106d6.0.1716270835597; Mon, 20 May 2024 22:53:55 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <153b8bf3-961a-45c9-b808-a18c90d828b7@beccati.com> In-Reply-To: <153b8bf3-961a-45c9-b808-a18c90d828b7@beccati.com> Date: Tue, 21 May 2024 06:53:44 +0100 Message-ID: Subject: Re: [PHP-DEV] ext/pgsql: pg_put_line deprecation proposal To: Matteo Beccati Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000007e961f0618f07184" From: devnexen@gmail.com (David CARLIER) --0000000000007e961f0618f07184 Content-Type: text/plain; charset="UTF-8" Hi Matteo, On Mon, 20 May 2024 at 14:08, Matteo Beccati wrote: > Hi, > > Il 20/05/2024 14:03, David CARLIER ha scritto: > > I would like to know if it would be fine to deprecate pg_put_line > > . > > > > Reasoning is PQPutLine is part of the obsolete list of calls for COPY > > purpose > > since > the PostgreSQL protocol 3.0 version (supported since postgresql 7.4 > released about 20 years ago, see New client-to-server protocol regarding > COPY ). > > > > Related PR . > > I have fond memories of using pg_put_line several years ago! > > It is true that it's obsolete and although they still work, they are > deprecated in libpq. > > However, I have a few remarks... > > If you're targeting the protocol 3.0 change, what is deprecated is the > pg_put_line('\\.') call that needed to be sent before calling > pg_end_copy(). > > pg_put_line() is used to send data, not just the end message. > > Hence, the UPGRADING message misrepresents the reason why pg_put_line() > is deprecated. > > In case we really decide to deprecate pg_put_line on the PHP side, so > should be pg_end_copy. > > However we don't provide a full alternative to it, because pg_copy_from > only accepts arrays, according to the documentation. As such, there is > no real alternative for "streaming" data without storing it all in memory. > Thanks for your thoughts, I ve overlooked this. > > Unless we provide it, I would vote against deprecating them. > > My opinion could change if pg_copy_from() worked with generators, but I > still think the two function still have a place for those needing > low-level access. > > > Cheers > -- > Matteo Beccati > > Development & Consulting - http://www.beccati.com/ > --0000000000007e961f0618f07184 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Matteo,

On Mon, 20 May 2024 at 14:08, M= atteo Beccati <php@beccati.com>= ; wrote:
Hi,

Il 20/05/2024 14:03, David CARLIER ha scritto:
> I would like to know if it would be fine to deprecate pg_put_line
> <http://pg_put_line>.
>
> Reasoning is PQPutLine is part of the obsolete list=C2=A0of calls for = COPY
> purpose
> <https://www.postgres= ql.org/docs/current/libpq-copy.html#LIBPQ-PQPUTLINE>=C2=A0since the = PostgreSQL protocol 3.0 version (supported since postgresql 7.4 released ab= out 20 years ago, see New client-to-server protocol regarding COPY <https://www.postgresql.org/docs/7.4/release-7-4.html= >).
>
> Related PR <https://github.com/php/php-src/pull/142= 50>.

I have fond memories of using pg_put_line several years ago!

It is true that it's obsolete and although they still work, they are deprecated in libpq.

However, I have a few remarks...

If you're targeting the protocol 3.0 change, what is deprecated is the =
pg_put_line('\\.') call that needed to be sent before calling pg_en= d_copy().

pg_put_line() is used to send data, not just the end message.

Hence, the UPGRADING message misrepresents the reason why pg_put_line() is deprecated.

In case we really decide to deprecate pg_put_line on the PHP side, so
should be pg_end_copy.

However we don't provide a full alternative to it, because pg_copy_from=
only accepts arrays, according to the documentation. As such, there is
no real alternative for "streaming" data without storing it all i= n memory.

Thanks for your thoughts, I v= e overlooked this.=C2=A0

Unless we provide it, I would vote against deprecating them.

My opinion could change if pg_copy_from() worked with generators, but I still think the two function still have a place for those needing
low-level access.


Cheers
--
Matteo Beccati

Development & Consulting - http://www.beccati.com/
--0000000000007e961f0618f07184--