mirror of
https://github.com/alanorth/cgspace-notes.git
synced 2025-01-27 05:49:12 +01:00
Add notes for 2018-06-24
This commit is contained in:
@ -41,7 +41,7 @@ sys 2m7.289s
|
||||
|
||||
<meta property="article:published_time" content="2018-06-04T19:49:54-07:00"/>
|
||||
|
||||
<meta property="article:modified_time" content="2018-06-14T12:40:42+03:00"/>
|
||||
<meta property="article:modified_time" content="2018-06-14T14:46:09+03:00"/>
|
||||
|
||||
|
||||
|
||||
@ -93,9 +93,9 @@ sys 2m7.289s
|
||||
"@type": "BlogPosting",
|
||||
"headline": "June, 2018",
|
||||
"url": "https://alanorth.github.io/cgspace-notes/2018-06/",
|
||||
"wordCount": "1637",
|
||||
"wordCount": "1814",
|
||||
"datePublished": "2018-06-04T19:49:54-07:00",
|
||||
"dateModified": "2018-06-14T12:40:42+03:00",
|
||||
"dateModified": "2018-06-14T14:46:09+03:00",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "Alan Orth"
|
||||
@ -427,6 +427,25 @@ UPDATE 1
|
||||
<li>I uploaded the seventy-six book chapters to the IWMI Book Chapters collection: <a href="https://cgspace.cgiar.org/handle/10568/36178">https://cgspace.cgiar.org/handle/10568/36178</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="2018-06-24">2018-06-24</h2>
|
||||
|
||||
<ul>
|
||||
<li>I was restoring a PostgreSQL dump on my test machine and found a way to restore the CGSpace dump as the <code>postgres</code> user, but have the owner of the schema be the <code>dspacetest</code> user:</li>
|
||||
</ul>
|
||||
|
||||
<pre><code>$ dropdb -h localhost -U postgres dspacetest
|
||||
$ createdb -h localhost -U postgres -O dspacetest --encoding=UNICODE dspacetest
|
||||
$ psql -h localhost -U postgres dspacetest -c 'alter user dspacetest superuser;'
|
||||
$ pg_restore -h localhost -U postgres -d dspacetest -O --role=dspacetest -W -h localhost /tmp/cgspace_2018-06-24.backup
|
||||
$ psql -h localhost -U postgres dspacetest -c 'alter user dspacetest nosuperuser;'
|
||||
</code></pre>
|
||||
|
||||
<ul>
|
||||
<li>The <code>-O</code> option to <code>pg_restore</code> makes the import process ignore ownership specified in the dump itself, and instead makes the schema owned by the user doing the restore</li>
|
||||
<li>I always prefer to use the <code>postgres</code> user locally because it’s just easier than remembering the <code>dspacetest</code> user’s password, but then I couldn’t figure out why the resulting schema was owned by <code>postgres</code></li>
|
||||
<li>So with this you connect as the <code>postgres</code> superuser and then switch roles to <code>dspacetest</code> (also, make sure this user has <code>superuser</code> privileges before the restore)</li>
|
||||
</ul>
|
||||
|
||||
<!-- vim: set sw=2 ts=2: -->
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user