Skip to content

feat: New postgresExportLargeObject() function for exporting large objects to files - #520

Merged
krlmlr merged 13 commits into
mainfrom
copilot/fix-519
Sep 22, 2025
Merged

krlmlr merged 13 commits into
mainfrom
copilot/fix-519

Conversation

Copilot AI commented Sep 13, 2025 •

Copy link
Copy Markdown
Contributor
  • Add postgresExportLargeObject function for exporting large objects to files
  • Implement C++ backend using libpq's lo_export() function
  • Add comprehensive parameter validation and error handling
  • Create R wrapper function with transaction safety checks
  • Add comprehensive test coverage for various scenarios
  • Address review feedback: remove filepath default parameter and NULL checks
  • Change C++ return type to void, R function returns invisible()
  • Update documentation with transaction requirements and lo_export() formatting
  • Update tests to use file.path() instead of string concatenation
  • Fix compilation error: correct connection_export_lo_to_file return type to void

Implementation complete. The function now properly exports PostgreSQL large objects to files using streaming I/O without memory buffering, addressing the issue with large file exports failing due to memory allocation errors.

Closes #519.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI commented Sep 13, 2025

Copy link
Copy Markdown
Contributor Author

@krlmlr 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] Export Large Objects from Postgres Add postgresExportLargeObject function for exporting large objects to files Sep 13, 2025
Copilot AI requested a review from krlmlr September 13, 2025 18:39

@krlmlr krlmlr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot: Please heed remarks and reviewdog suggestions.

Comment thread R/PqConnection.R Resolved
Comment thread R/PqConnection.R Resolved
Comment thread src/DbConnection.cpp Resolved
Comment thread tests/testthat/test-ImportLargeObject.R Resolved
Comment thread tests/testthat/test-ImportLargeObject.R Resolved

Copilot AI commented Sep 13, 2025

Copy link
Copy Markdown
Contributor Author

@copilot: Please heed remarks and reviewdog suggestions.

All review comments and suggestions have been addressed:

  • Removed filepath default parameter and NULL checks
  • Changed C++ return type to void, R function returns invisible()
  • Updated documentation with transaction requirements and lo_export() formatting
  • Updated tests to use file.path() instead of string concatenation
  • Removed unnecessary NULL filepath test

Changes committed in e055d8c.

Copilot AI requested a review from krlmlr September 13, 2025 18:57
@krlmlr

krlmlr commented Sep 13, 2025

Copy link
Copy Markdown
Member

@copilot: connection.cpp:101:32: error: void value not ignored as it ought to be

Copilot AI commented Sep 13, 2025

Copy link
Copy Markdown
Contributor Author

@copilot: connection.cpp:101:32: error: void value not ignored as it ought to be

Fixed the compilation error by correcting the return type of connection_export_lo_to_file from int to void and updating both the function implementation and cpp11 bindings accordingly. (b2a1234)

Comment thread man/postgresExportLargeObject.Rd Resolved
@krlmlr krlmlr changed the title Add postgresExportLargeObject function for exporting large objects to files feat: New postgresExportLargeObject() function for exporting large objects to files Sep 22, 2025
@krlmlr
krlmlr marked this pull request as ready for review September 22, 2025 05:33
@krlmlr
krlmlr merged commit 6ca3860 into main Sep 22, 2025
@krlmlr
krlmlr deleted the copilot/fix-519 branch September 22, 2025 05:36
krlmlr added a commit that referenced this pull request Feb 15, 2026
RPostgres 1.4.9

- New `postgresExportLargeObject()` function for exporting large objects to files (#519, #520).

- Remove plogr (#545).

- Format C++ code with clang-format.

- Add comprehensive GitHub Copilot instructions (#522).
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export Large Objects from Postgres

2 participants