test.sql
application/octet-stream
Filename: test.sql
Type: application/octet-stream
Part: 1
CREATE TABLE t (
id INT PRIMARY KEY,
int_col1 INT NOT NULL,
int_col2 INT,
text_col1 TEXT,
text_col2 TEXT,
timestampz_col1 TIMESTAMPTZ,
int_col3 INT,
text_col3 TEXT,
text_col4 TEXT,
timestampz_col2 TIMESTAMPTZ
);
INSERT INTO t
SELECT
s, -- id: Sequential number starting from 1
(s % 1000) * 100, -- int_col1: Calculated value based on the sequence number
(random() * 1000000)::int, -- int_col2: Random integer between 0 and 1,000,000
'Test_Data_Row_' || s, -- text_col1: String with a fixed prefix and the sequence number
md5(random()::text), -- text_col2: Random MD5 hash string
now() - (s || ' seconds')::interval, -- timestampz_col1: Timestamp going back in seconds from the current time
s / 100, -- int_col3: Integer value from dividing the sequence number
'Category_' || (s % 50), -- text_col3: Category-like string with 50 variations
repeat(md5(s::text), 5), -- text_col4: Long string by repeating the MD5 hash of the sequence number 5 times
now() + (s || ' minutes')::interval -- timestampz_col2: Timestamp going forward in minutes from the current time
FROM
generate_series(1, 1000000) AS s; -- Generate a series of numbers from 1 to 1,000,000
COPY t TO '/tmp/t.csv' (FORMAT csv);