Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all I created an RPM (through a SPEC file I specified) that's supposed to perform database operations. One of those operations (on uninstall) is the following: Code: %postun echo ...
  1. #1
    Just Joined!
    Join Date
    Dec 2006
    Posts
    5

    Question [SOLVED] syntax error near unexpected token `(' while installing RPM than runs psql c

    Hi all

    I created an RPM (through a SPEC file I specified) that's supposed to perform database operations. One of those operations (on uninstall) is the following:

    Code:
    %postun
    echo "Deleting items from database..."
    psql HARDWARE_DB postgres -c "delete from maintable where id in (select item_id from items where item_name ='TABLE') ;"
    If I execute the command above directly in the shell it works fine. However, when I run the RPM uninstall I get an error:

    syntax error near unexpected token `('

    I tried to escape the "(", by using backslash. Then it complained the same thing about ")", so I also escaped it using "\)":

    Code:
    %postun
    echo "Deleting items from database..."
    psql HARDWARE_DB postgres -c "delete from maintable where id in \(select item_id from items where item_name ='TABLE'\) ;"
    But then, I got a new error (even though all double quotes have the matching pair):

    Unexpected EOF while looking for matching `"'

    Any ideas?
    Thanks in advance

  2. #2
    Just Joined!
    Join Date
    Dec 2006
    Posts
    5
    Oops.....

    There was a (dumb...) error indeed but on a previous line. I was escaping a double quote and I had "\ instead of \" ...

    So there's no need to escape the "(" nor ")" . The error was just that one (should have slept a few more hours before posting this...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...