pg_copy_from
Function • Params changed in PHP 8.5
Insert records into a table from an array.
pg_copy_from Function synopsis
pg_copy_from(
PgSql\Connection $connection,
string $table_name,
Traversable|array $rows,
string $separator = "\t",
string $null_as = "\\\\N"
): bool
Parameters
$connection
TypePgSql\Connection
$table_name
Typestring
Name of the table into which to copy the $rows.
$rows
TypeTraversable|array
An array of data to be copied into $table_name.
Each value in $rows becomes a row in $table_name.
Each value in $rows should be a delimited string of the values
to insert into each field. Values should be linefeed terminated.
$separator
OptionalTypestringDefault value"\t"
The token that separates values for each field in each element of
$rows. Default is \t.
$null_as
OptionalTypestringDefault value"\\N"
How SQL NULL values are represented in the
$rows. Default is \\N ("\\\\N").
Return value
Typebool
Returns true on success, false on failure
Changes to the pg_copy_from Function
PHP 8.5
- Parameter type changed for parameter #3 (
$rows):arraytoTraversable|array
pg_copy_from(
PgSql\Connection $connection,
string $table_name,
- array $rows,
+ Traversable|array $rows,
string $separator = "\t",
string $null_as = "\\\\N"
): bool PHP 8.1
- Parameter type added for parameter #1 (
$connection):PgSql\Connection
pg_copy_from(
- $connection,
+ PgSql\Connection $connection,
string $table_name,
array $rows,
string $separator = "\t",
string $null_as = "\\\\N"
): bool PHP 8.0
- Return type added:
bool - Parameter type added for parameter #2 (
$table_name):string - Parameter type added for parameter #3 (
$rows):array - Parameter name of parameter #4 changed:
$delimiterto$separator - Parameter type added for parameter #4 (
$separator):string - Parameter default value added for position #4 (
$separator):"\t" - Parameter type added for parameter #5 (
$null_as):string - Parameter default value added for position #5 (
$null_as):"\\\\N"
pg_copy_from(
$connection,
- $table_name,
+ string $table_name,
- $rows,
+ array $rows,
- $delimiter,
+ string $separator = "\t",
- $null_as
+ string $null_as = "\\\\N"
- )
+ ): bool pg_copy_from Function Availability
pg_copy_from Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes |
| PHP 8.5Upcoming Release | Yes |
| PHP 8.4Supported (Latest) | Yes |
| PHP 8.3Supported | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Security-Fixes Only | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |