Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 如何在Postgres中大容量插入到带有循环的表_Postgresql - Fatal编程技术网

Postgresql 如何在Postgres中大容量插入到带有循环的表

Postgresql 如何在Postgres中大容量插入到带有循环的表,postgresql,Postgresql,为了根据数据测试报表,我想将测试数据插入PostgresSQL中的表中 例如: INSERT INTO call_logs (phonenumber,timeofcall) VALUES ('+12121001001','2014-12-23T07:01:00.000+00:00') 但我想循环,比如说,59次,让电话号码2121001001、1002、1003等与通话时间07:01、07:02、07:03等联系起来 我如何使用循环来实现这一点 谢谢。您不需要循环。使用 这会增加电话号码吗?2

为了根据数据测试报表,我想将测试数据插入PostgresSQL中的表中

例如:

INSERT INTO call_logs (phonenumber,timeofcall) VALUES ('+12121001001','2014-12-23T07:01:00.000+00:00')
但我想循环,比如说,59次,让电话号码2121001001、1002、1003等与通话时间07:01、07:02、07:03等联系起来

我如何使用循环来实现这一点


谢谢。

您不需要循环。使用


这会增加电话号码吗?212-100-1001、212-100-1002等等。此外,为了简单起见,我省略了一些列,但我确实有一些其他列不会改变值。那么SQL语句将是怎样的呢?谢谢
insert into call_logs (column1, phonenumber,timeofcall)
select
    'constant_value',
    '+' || generate_series(12121001001, 12121001059),
    generate_series(
        '2014-12-23t07:01:00.000+00:00'::timestamp,
        '2014-12-23t07:59:00.000+00:00',
        '1 minute'
    )