Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Practical PostgreSQL Operations and Solutions

Tech 1

tk.mybatis Pagination Control

// Set maximum results for query
// Append SQL clause directly as shown below
// Note SQL keyword order for similar requirements
Example queryExample = new Example(Entity.class);
queryExample.setOrderByClause("driver_code ASC LIMIT " + maxResults);

PostgreSQL Backup Operations

Database Backup

# Grant permissions to target directory
chown postgres:postgres /target

# Switch to postgres user
su - postgres

# Execute backup
cd /opt/fsepv13server64/bin
# Replace 'database' with actual database name
# -s flag backs up schema only (no data)
./pg_dump -Fp -s database > /target/schema_backup.sql

Configuration Reload

# Reload PostgreSQL configuration
pg_ctl reload -D /inst/data  # Replace with actual data directory

Data Import/Export with COPY

Binary Format Export

-- Export result set as binary data
-- Format changed in PostgreSQL 7.4
\copy (SELECT template FROM table WHERE ...) TO '/target/output.data' WITH (FORMAT binary)

Command-line Binary Operatoins

# Export via psql
psql -h host -p port -d dbname -X -c "COPY (SELECT col FROM table) TO STDOUT WITH BINARY" > data.bin

# Import via SQL
COPY target_table(column_list) FROM 'data.bin' WITH (FORMAT binary);

Troubleshootign

JIT Compilation Error

Error Message:
ERROR: could not load library "/opt/fsepv13server64/lib/llvmjit.so": libLLVM-10.so: cannot open shared object file

Cause:
JIT enabled but required library missing

Solution:
Disable JIT in postgresql.conf

jit = off

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.