Is the table secured to the wall with any sort of brackets? Mine (and a number of others I've seen) has a sort of tab latch that flips into a socket attached to the wall, with a heavy wire hinge thingy that holds it up and lets it swing down into berth position when unhooked. The non-wall end has a folding leg. The wall bracket system is adjustable to some degree by loosening some of the screws on the parts and sliding them (they have elongated holes to permit this), and adjusting can take up a good bit of looseness.
It's not as stable as a nice oak library table, say, but there's not much danger of accidentally spilling drinks, at least due to the table rocking. People like me can spill stuff even with the most stable table that scientific progress can produce.
If you don't have a wall bracket, what you're suggesting sounds reasonable to me. Typical wall construction would probably have thin plywood adhered to styrofoam insulation on the inside (or to slight studding and e.g. fiberglass insulation), and any sort of an appropriate anchor that isn't too deep should be fine. Glue is only as strong as wallpaper or whatever is covering the wall, which might be really strong and might not be. Examine how your window treatments etc. are mounted for some ideas on what should work.