dump

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: PostgreSQL Imports: 23 Imported by: 0

Documentation

Overview

Package fetch queries source database for objects and data

Index

Constants

View Source
const (
	PreData  = 0     // CREATE role, schemas, table.
	Data     = 10000 // one COPY per table, restart for sequences and identity.
	PostData = 20000 // CREATE indexes, constraints, etc.
)

Task number ranges for dump sections.

Allocate 10k numbers for each of dump sections. This allows to handle quite big schemas.

Variables

View Source
var CopyRate = monitoring.NewRate(" rows")
View Source
var CopyThroughput = monitoring.NewIRate("B")
View Source
var Params struct {
	Force    bool
	Owner    bool
	Clean    bool
	PreData  bool
	Data     bool
	PostData bool
}
View Source
var TableCount int

Functions

func AlterTableChecks

func AlterTableChecks(p dispatch.TaskAdder, ctg catalog.Catalog)

func AlterTablesDefaults

func AlterTablesDefaults(p dispatch.TaskAdder, ctg catalog.Catalog)

func AlterTablesForeignKeys

func AlterTablesForeignKeys(p dispatch.TaskAdder, ctg catalog.Catalog)

func AlterTablesKeys

func AlterTablesKeys(p dispatch.TaskAdder, ctg catalog.Catalog)

func CopyTables

func CopyTables(p *dispatch.Plan, tables []catalog.Table, srcctg any)

CopyTables instanciates COPY operations for a list of tables

func CopyTask

func CopyTask(source any, target catalog.Table, reqs []string) dispatch.Task

CopyTask instanciates a COPY operation for a table

Task weight is source table row count. Generates a COPY statement for each batch of rows. Use SetupExecute to configure query output.

func CreateIndexes

func CreateIndexes(p dispatch.TaskAdder, ctg catalog.Catalog)

func CreateRoles

func CreateRoles(p dispatch.TaskAdder, ctg catalog.Catalog)

CreateRoles generates CREATE ROLE tasks

func CreateSchemas

func CreateSchemas(p dispatch.TaskAdder, ctg catalog.Catalog)

CreateSchemas generates CREATE SCHEMA tasks

func CreateSequences

func CreateSequences(p dispatch.TaskAdder, ctg catalog.Catalog)

CreateSequences generates CREATE SEQUENCE tasks

func CreateTables

func CreateTables(p dispatch.TaskAdder, ctg catalog.Catalog)

CreateTables generates CREATE TABLE tasks

func DataPriority

func DataPriority(p int) int

DataPriority priorize data over DDL

Prevent post-data to run before sequences or copy, in case there is no logical dependencies. This way, task of each plan section are more clustered.

func RestartIdentities

func RestartIdentities(tables []catalog.Table, src any) dispatch.Task

RestartIdentities fetches identities start from source and generates ALTER COLUMN.

Returns nil if no tables have identity column.

Requires source connection in context from database.WithConnection.

func RestartSequences

func RestartSequences(seqs []catalog.Sequence, src any) dispatch.Task

RestartSequences fetches sequences start from source and generates ALTER SEQUENCE.

Returns nil if no sequences are given. Group sequence restart by schema.

Requires catalog.FilterSchemas to be set with schemas containing sequences. Requires source connection in context from database.WithConnection.

func Value

func Value(path, from, to string, chunked bool) valueFactory

Value instanciates converters for a single column value.

If data does not requires conversion, copy to a new memory segment so that initial data can be freed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL